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/parser/cxfa_node.cpp | 4 ++-- xfa/fxfa/parser/cxfa_node.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'xfa/fxfa/parser') diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 02d1c0f6f3..b04e427a10 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -1538,7 +1538,7 @@ CXFA_Border* CXFA_Node::GetOrCreateBorder() { return JSObject()->GetOrCreateProperty(0, XFA_Element::Border); } -CXFA_Caption* CXFA_Node::GetCaption() const { +CXFA_Caption* CXFA_Node::GetCaptionIfExists() const { return JSObject()->GetProperty(0, XFA_Element::Caption); } @@ -1917,7 +1917,7 @@ WideString CXFA_Node::GetValidateCaptionName(bool bVersionFlag) { WideString wsCaptionName; if (!bVersionFlag) { - CXFA_Caption* caption = GetCaption(); + CXFA_Caption* caption = GetCaptionIfExists(); if (caption) { CXFA_Value* capValue = caption->GetValue(); if (capValue) { diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h index b175a83a84..2ada0083a0 100644 --- a/xfa/fxfa/parser/cxfa_node.h +++ b/xfa/fxfa/parser/cxfa_node.h @@ -238,7 +238,7 @@ class CXFA_Node : public CXFA_Object { CXFA_Border* GetBorderIfExists() const; CXFA_Border* GetOrCreateBorder(); - CXFA_Caption* GetCaption() const; + CXFA_Caption* GetCaptionIfExists() const; CXFA_Font* GetFont() const; CXFA_Font* GetOrCreateFont(); -- cgit v1.2.3