summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_widget.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-08-17 13:28:51 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-17 13:28:51 -0700
commit9282819ce86f93ca46a73adb43b5c50289f4c99e (patch)
tree1974e2626210b3078e6bc95d39f6a5c17d32963d /fpdfsdk/cpdfsdk_widget.cpp
parentd691899dbff8a8aa024596302fcea1f7d7935252 (diff)
downloadpdfium-9282819ce86f93ca46a73adb43b5c50289f4c99e.tar.xz
Speculative fix for DrawAppearance issue
If the control is not found in the CPDF_InterForm control map then ::GetControlByDict can return nullptr. This nullptr was not handled in CPDFSDK_Widget::GetFormField(). This Cl propagates the nullptr back up to the caller methods and fixes the returns as needed. This is a speculative crash to fix the referenced bug. BUG=chromium:637953 Review-Url: https://codereview.chromium.org/2256783003
Diffstat (limited to 'fpdfsdk/cpdfsdk_widget.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_widget.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index 3da86aa11f..a36014c924 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -519,7 +519,8 @@ FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid(
}
int CPDFSDK_Widget::GetFieldType() const {
- return GetFormField()->GetFieldType();
+ CPDF_FormField* pField = GetFormField();
+ return pField ? pField->GetFieldType() : FIELDTYPE_UNKNOWN;
}
FX_BOOL CPDFSDK_Widget::IsAppearanceValid() {
@@ -554,7 +555,8 @@ CFX_ByteString CPDFSDK_Widget::GetSubType() const {
}
CPDF_FormField* CPDFSDK_Widget::GetFormField() const {
- return GetFormControl()->GetField();
+ CPDF_FormControl* pControl = GetFormControl();
+ return pControl ? pControl->GetField() : nullptr;
}
CPDF_FormControl* CPDFSDK_Widget::GetFormControl() const {