summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/text/XMLChangedRegionImportContext.cxx11
-rw-r--r--xmloff/source/text/txtparai.cxx17
2 files changed, 21 insertions, 7 deletions
diff --git a/xmloff/source/text/XMLChangedRegionImportContext.cxx b/xmloff/source/text/XMLChangedRegionImportContext.cxx
index 4d43a8de3027..fe00c4a058b9 100644
--- a/xmloff/source/text/XMLChangedRegionImportContext.cxx
+++ b/xmloff/source/text/XMLChangedRegionImportContext.cxx
@@ -122,9 +122,14 @@ void XMLChangedRegionImportContext::endFastElement(sal_Int32 )
{
// delete last paragraph
// (one extra paragraph was inserted in the beginning)
- rtl::Reference<XMLTextImportHelper> rHelper =
- GetImport().GetTextImport();
- rHelper->DeleteParagraph();
+ try
+ {
+ GetImport().GetTextImport()->DeleteParagraph();
+ }
+ catch (uno::Exception const&)
+ { // cursor may be disposed - must reset to old cursor!
+ SAL_INFO("xmloff.text", "XMLChangedRegionImportContext: delete paragraph failed");
+ }
GetImport().GetTextImport()->SetCursor(xOldCursor);
xOldCursor = nullptr;
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index 9844e2628c89..5fffc202612a 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -1688,10 +1688,19 @@ void XMLParaContext::endFastElement(sal_Int32 )
{
rtl::Reference < XMLTextImportHelper > xTxtImport(
GetImport().GetTextImport());
- Reference < XTextRange > xCrsrRange( xTxtImport->GetCursorAsRange() );
- if( !xCrsrRange.is() )
- return; // Robust (defective file)
- Reference < XTextRange > xEnd(xCrsrRange->getStart());
+ Reference<XTextRange> xEnd;
+ try
+ {
+ Reference<XTextRange> const xCrsrRange(xTxtImport->GetCursorAsRange());
+ if (!xCrsrRange.is())
+ return; // Robust (defective file)
+ xEnd = xCrsrRange->getStart();
+ }
+ catch (uno::Exception const&)
+ {
+ SAL_INFO("xmloff.text", "XMLParaContext: cursor disposed?");
+ return;
+ }
// if we have an id set for this paragraph, get a cursor for this
// paragraph and register it with the given identifier