Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(480)

Unified Diff: fpdfsdk/src/javascript/app.cpp

Issue 1482253002: Fix an issue that no response from the call back function of FFI_GetLanguage() (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698