summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2012-02-10 17:54:03 +0100
committerJan Holesovsky <kendy@suse.cz>2012-02-13 13:08:25 +0100
commit86a03eb68e395410143f892110b0e40ccdded0c2 (patch)
treecb287756b4026c3cc29ac586895789dd61f095be
parent0fe67dc40760b4ff7cdc1325bb4e97a3ce259ccb (diff)
fdo#42771: Fix crash when loading an invalid .fodt.
createTextCursorByRange() likes to throw runtime exception, even though it just means 'we were unable to create the cursor'. Signed-off-by: Michael Meeks <michael.meeks@suse.com>
-rw-r--r--xmloff/source/text/txtparai.cxx14
1 files changed, 10 insertions, 4 deletions
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index 66d8f005c88f..30c364d8cbf7 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -2032,10 +2032,16 @@ XMLParaContext::~XMLParaContext()
xTxtImport->InsertControlCharacter( ControlCharacter::APPEND_PARAGRAPH );
// create a cursor that select the whole last paragraph
- Reference < XTextCursor > xAttrCursor(
- xTxtImport->GetText()->createTextCursorByRange( xStart ));
- if( !xAttrCursor.is() )
- return; // Robust (defect file)
+ Reference < XTextCursor > xAttrCursor;
+ try {
+ xAttrCursor = xTxtImport->GetText()->createTextCursorByRange( xStart );
+ if( !xAttrCursor.is() )
+ return; // Robust (defect file)
+ } catch (uno::Exception &) {
+ // createTextCursorByRange() likes to throw runtime exception, even
+ // though it just means 'we were unable to create the cursor'
+ return;
+ }
xAttrCursor->gotoRange( xEnd, sal_True );
// xml:id for RDF metadata