From 14b20dba4e47c6ac3cb119e23bac42e3debb56e4 Mon Sep 17 00:00:00 2001 From: Jun Fang Date: Tue, 1 Dec 2015 12:35:24 +0800 Subject: Fix an assertion failure in CPDFSDK_Widget* Field::GetWidget() BUG=pdfium:291 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1487553003 . --- fpdfsdk/src/javascript/Field.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'fpdfsdk') 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(pDocument->GetInterForm()); + return pInterForm ? pInterForm->GetWidget(pFormControl) : nullptr; } FX_BOOL Field::ValueIsOccur(CPDF_FormField* pFormField, -- cgit v1.2.3