summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-02-23 13:08:16 +0000
committerAndras Timar <andras.timar@collabora.com>2018-03-06 16:34:22 +0100
commit73ed58408d0322addfa7d23c9951f8ea12fa49c7 (patch)
tree6221a95692a17b975acec17888ecc4231ece1451 /xmloff
parentce1578c34f5df12169be117af18d92235f160f4b (diff)
forcepoint #5 null deref
Change-Id: I95b67f98b7028d7ca7c4a9d1c15100e42d359816 Reviewed-on: https://gerrit.libreoffice.org/50243 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit 6ba5fc85224b8bb0b8e2a5c5013e83644c622e30)
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 abccc08c56d4..bd565e4cfaf3 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -1528,9 +1528,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());
}
SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext(
@@ -1926,7 +1931,7 @@ XMLParaContext::~XMLParaContext()
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
@@ -1952,7 +1957,7 @@ XMLParaContext::~XMLParaContext()
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'