summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript
diff options
context:
space:
mode:
authorJun Fang <jun_fang@foxitsoftware.com>2015-12-01 12:35:24 +0800
committerJun Fang <jun_fang@foxitsoftware.com>2015-12-01 12:35:24 +0800
commit14b20dba4e47c6ac3cb119e23bac42e3debb56e4 (patch)
tree9b18c71c09d23b3e40349baba2a09c1163e80d68 /fpdfsdk/src/javascript
parent0e4e36878682e22678bb061e77d73f3a4581985c (diff)
downloadpdfium-14b20dba4e47c6ac3cb119e23bac42e3debb56e4.tar.xz
Fix an assertion failure in CPDFSDK_Widget* Field::GetWidget()
BUG=pdfium:291 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1487553003 .
Diffstat (limited to 'fpdfsdk/src/javascript')
-rw-r--r--fpdfsdk/src/javascript/Field.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/fpdfsdk/src/javascript/Field.cpp b/fpdfsdk/src/javascript/Field.cpp
index 39e15e9868..d3531a4aa3 100644
--- a/fpdfsdk/src/javascript/Field.cpp
+++ b/fpdfsdk/src/javascript/Field.cpp
@@ -289,13 +289,9 @@ void Field::UpdateFormControl(CPDFSDK_Document* pDocument,
CPDFSDK_Widget* Field::GetWidget(CPDFSDK_Document* pDocument,
CPDF_FormControl* pFormControl) {
- ASSERT(pDocument != NULL);
- ASSERT(pFormControl != NULL);
-
- CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
-
- return pInterForm->GetWidget(pFormControl);
+ CPDFSDK_InterForm* pInterForm =
+ static_cast<CPDFSDK_InterForm*>(pDocument->GetInterForm());
+ return pInterForm ? pInterForm->GetWidget(pFormControl) : nullptr;
}
FX_BOOL Field::ValueIsOccur(CPDF_FormField* pFormField,