Chromium Code Reviews| Index: fpdfsdk/src/javascript/app.cpp |
| diff --git a/fpdfsdk/src/javascript/app.cpp b/fpdfsdk/src/javascript/app.cpp |
| index d18e0322abff79c17035657eb85f9a354cc11913..b3a9000242211f744e45771cc0bd59d51a0d0d0b 100644 |
| --- a/fpdfsdk/src/javascript/app.cpp |
| +++ b/fpdfsdk/src/javascript/app.cpp |
| @@ -228,12 +228,24 @@ FX_BOOL app::platform(IJS_Context* cc, |
| FX_BOOL app::language(IJS_Context* cc, |
| CJS_PropValue& vp, |
| CFX_WideString& sError) { |
| - if (vp.IsGetting()) { |
| + if (!vp.IsGetting()) |
| + return FALSE; |
| + CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
|
Tom Sepez
2015/11/30 17:08:39
Can these actually be null? we don't check it in o
|
| + if (!pContext) |
| + return FALSE; |
| + CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
| + if (!pRuntime) |
| + return FALSE; |
| + CPDFDoc_Environment* pEnv = pRuntime->GetReaderApp(); |
| + if (!pEnv) |
| + return FALSE; |
| + CFX_WideString language = pEnv->FFI_GetLanguage(); |
| + if (language.IsEmpty()) |
| vp << JS_STR_LANGUANGE; |
| - return TRUE; |
| - } |
| + else |
| + vp << language; |
| - return FALSE; |
| + return TRUE; |
| } |
| // creates a new fdf object that contains no data |