summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-02-23 13:08:16 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-02-23 16:50:39 +0100
commita3f5be83da9a1147c102122a89f17e2b75e062fe (patch)
tree3fc11e5be252dce593b919285d4ccd77acf6b9e0 /xmloff
parent060c6a01a23375ba60ac8158e1b97edc9ac49f03 (diff)
forcepoint #5 null deref
Change-Id: I95b67f98b7028d7ca7c4a9d1c15100e42d359816 Reviewed-on: https://gerrit.libreoffice.org/50242 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/text/txtparai.cxx15
1 files changed, 10 insertions, 5 deletions
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index c4a1c05ace24..660ffe7dee44 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -1484,9 +1484,14 @@ XMLImpSpanContext_Impl::XMLImpSpanContext_Impl(
XMLImpSpanContext_Impl::~XMLImpSpanContext_Impl()
{
- if( pHint )
- pHint->SetEnd( GetImport().GetTextImport()
- ->GetCursorAsRange()->getStart() );
+ if (!pHint)
+ return;
+
+ Reference<XTextRange> xCrsrRange(GetImport().GetTextImport()->GetCursorAsRange());
+ if (!xCrsrRange.is())
+ return; // Robust (defective file)
+
+ pHint->SetEnd(xCrsrRange->getStart());
}
SvXMLImportContextRef XMLImpSpanContext_Impl::CreateChildContext(
@@ -1881,7 +1886,7 @@ void XMLParaContext::EndElement()
GetImport().GetTextImport());
Reference < XTextRange > xCrsrRange( xTxtImport->GetCursorAsRange() );
if( !xCrsrRange.is() )
- return; // Robust (defect file)
+ return; // Robust (defective file)
Reference < XTextRange > xEnd(xCrsrRange->getStart());
// if we have an id set for this paragraph, get a cursor for this
@@ -1907,7 +1912,7 @@ void XMLParaContext::EndElement()
try {
xAttrCursor = xTxtImport->GetText()->createTextCursorByRange( xStart );
if( !xAttrCursor.is() )
- return; // Robust (defect file)
+ return; // Robust (defective file)
} catch (const uno::Exception &) {
// createTextCursorByRange() likes to throw runtime exception, even
// though it just means 'we were unable to create the cursor'