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..3f1a3b7648079be629f5150d9bb7be0411ba926c 100644 |
| --- a/fpdfsdk/src/javascript/app.cpp |
| +++ b/fpdfsdk/src/javascript/app.cpp |
| @@ -217,12 +217,23 @@ FX_BOOL app::viewerVersion(IJS_Context* cc, |
| FX_BOOL app::platform(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); |
| + if (!pContext) |
|
Tom Sepez
2015/11/30 17:17:32
Can these ever be NULL?
jun_fang
2015/12/01 10:53:30
pContext is passed from v8. It shouldn't be nullpt
|
| + return FALSE; |
| + CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
| + if (!pRuntime) |
|
jun_fang
2015/12/01 10:53:30
pRuntime shouldn't be nullptr either.
|
| + return FALSE; |
| + CPDFDoc_Environment* pEnv = pRuntime->GetReaderApp(); |
| + if (!pEnv) |
|
jun_fang
2015/12/01 10:53:30
pEnv can be nullptr.
|
| + return FALSE; |
| + CFX_WideString platfrom = pEnv->FFI_GetPlatform(); |
| + if (platfrom.IsEmpty()) |
| vp << JS_STR_PLATFORM; |
| - return TRUE; |
| - } |
| - |
| - return FALSE; |
| + else |
| + vp << platfrom; |
| + return TRUE; |
| } |
| FX_BOOL app::language(IJS_Context* cc, |