summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_scriptcontext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/parser/cxfa_scriptcontext.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_scriptcontext.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.cpp b/xfa/fxfa/parser/cxfa_scriptcontext.cpp
index 2100299616..fcf22442f1 100644
--- a/xfa/fxfa/parser/cxfa_scriptcontext.cpp
+++ b/xfa/fxfa/parser/cxfa_scriptcontext.cpp
@@ -115,7 +115,10 @@ const XFA_METHODINFO* GetMethodByName(XFA_Element eElement,
// static.
CXFA_Object* CXFA_ScriptContext::ToObject(CFXJSE_Value* pValue,
CFXJSE_Class* pClass) {
- return static_cast<CXFA_Object*>(pValue->ToHostObject(pClass));
+ CFXJSE_HostObject* pHostObj = pValue->ToHostObject(pClass);
+ if (!pHostObj || pHostObj->type() != CFXJSE_HostObject::kXFA)
+ return nullptr;
+ return static_cast<CXFA_Object*>(pHostObj);
}
CXFA_ScriptContext::CXFA_ScriptContext(CXFA_Document* pDocument)