From 1e6490da6fb813930d1073ac05ace8a21fa9ca28 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 10 Jan 2018 19:34:57 +0000 Subject: 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 Commit-Queue: dsinclair --- xfa/fxfa/cxfa_ffpushbutton.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'xfa/fxfa/cxfa_ffpushbutton.cpp') diff --git a/xfa/fxfa/cxfa_ffpushbutton.cpp b/xfa/fxfa/cxfa_ffpushbutton.cpp index e3ca6eedff..62d692469d 100644 --- a/xfa/fxfa/cxfa_ffpushbutton.cpp +++ b/xfa/fxfa/cxfa_ffpushbutton.cpp @@ -104,9 +104,10 @@ bool CXFA_FFPushButton::PerformLayout() { if (margin) XFA_RectWidthoutMargin(rtWidget, margin); - CXFA_Caption* caption = m_pNode->GetCaption(); m_rtCaption = rtWidget; - CXFA_Margin* captionMargin = caption->GetMargin(); + + CXFA_Caption* caption = m_pNode->GetCaptionIfExists(); + CXFA_Margin* captionMargin = caption ? caption->GetMargin() : nullptr; if (captionMargin) XFA_RectWidthoutMargin(m_rtCaption, captionMargin); @@ -117,6 +118,7 @@ bool CXFA_FFPushButton::PerformLayout() { return true; } + float CXFA_FFPushButton::GetLineWidth() { CXFA_Border* border = m_pNode->GetBorderIfExists(); if (border && border->GetPresence() == XFA_AttributeEnum::Visible) @@ -133,7 +135,7 @@ FX_ARGB CXFA_FFPushButton::GetFillColor() { } void CXFA_FFPushButton::LoadHighlightCaption() { - CXFA_Caption* caption = m_pNode->GetCaption(); + CXFA_Caption* caption = m_pNode->GetCaptionIfExists(); if (!caption || caption->IsHidden()) return; @@ -169,7 +171,7 @@ void CXFA_FFPushButton::RenderHighlightCaption(CXFA_Graphics* pGS, CFX_Matrix* pMatrix) { CXFA_TextLayout* pCapTextLayout = m_pNode->GetWidgetAcc()->GetCaptionTextLayout(); - CXFA_Caption* caption = m_pNode->GetCaption(); + CXFA_Caption* caption = m_pNode->GetCaptionIfExists(); if (!caption || !caption->IsVisible()) return; -- cgit v1.2.3