diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-02-23 13:08:16 +0000 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2018-04-21 02:21:39 +0200 |
commit | 95ab3ee66a1be3749100d6b709ebed43c4b9b7c2 (patch) | |
tree | d9151a091d17deb9e520cc3d6fd067dc1f9daa5c /xmloff | |
parent | 64a00846e7827073e4b7447e8212c2fb9545a74d (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>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/text/txtparai.cxx | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx index c851e00b392a..cd56bae4ff69 100644 --- a/xmloff/source/text/txtparai.cxx +++ b/xmloff/source/text/txtparai.cxx @@ -1539,9 +1539,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( @@ -1936,7 +1941,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 @@ -1962,7 +1967,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' |