summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_ffcheckbutton.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-10 19:34:57 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-10 19:34:57 +0000
commit1e6490da6fb813930d1073ac05ace8a21fa9ca28 (patch)
treed1849bda5efcb3b3cd7c4a39580d36228b4ab696 /xfa/fxfa/cxfa_ffcheckbutton.cpp
parenta74e75d69594e469906e2a95b5f2394c88acbe7a (diff)
downloadpdfium-1e6490da6fb813930d1073ac05ace8a21fa9ca28.tar.xz
Rename GetCaption to GetCaptionIfExists
This CL renames GetCaption to GetCaptionIfExists to make it clear the value returned can be a nullptr. The various callsites have been fixed which used the caption without validating. Change-Id: I9b600ac9ab5b9e04dfa6e8cee95ef3e9d629688d Reviewed-on: https://pdfium-review.googlesource.com/22670 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_ffcheckbutton.cpp')
-rw-r--r--xfa/fxfa/cxfa_ffcheckbutton.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/xfa/fxfa/cxfa_ffcheckbutton.cpp b/xfa/fxfa/cxfa_ffcheckbutton.cpp
index 94fb9bd8a8..0b5bf53ef5 100644
--- a/xfa/fxfa/cxfa_ffcheckbutton.cpp
+++ b/xfa/fxfa/cxfa_ffcheckbutton.cpp
@@ -98,7 +98,7 @@ bool CXFA_FFCheckButton::PerformLayout() {
XFA_AttributeEnum iCapPlacement = XFA_AttributeEnum::Unknown;
float fCapReserve = 0;
- CXFA_Caption* caption = m_pNode->GetCaption();
+ CXFA_Caption* caption = m_pNode->GetCaptionIfExists();
if (caption && caption->IsVisible()) {
m_rtCaption = rtWidget;
iCapPlacement = caption->GetPlacementType();
@@ -122,7 +122,7 @@ bool CXFA_FFCheckButton::PerformLayout() {
}
m_rtUI = rtWidget;
- CXFA_Margin* captionMargin = caption->GetMargin();
+ CXFA_Margin* captionMargin = caption ? caption->GetMargin() : nullptr;
switch (iCapPlacement) {
case XFA_AttributeEnum::Left: {
m_rtCaption.width = fCapReserve;