diff options
author | Jan Holesovsky <kendy@suse.cz> | 2012-02-10 17:54:03 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2012-02-10 17:56:32 +0100 |
commit | 9951de4a10386a85dc1bfa465304cd0005414b8e (patch) | |
tree | 7c25e4c4844968188d7c6c35f960138f1685a80a /xmloff | |
parent | add back close button to the about dialog (diff) | |
download | core-9951de4a10386a85dc1bfa465304cd0005414b8e.tar.gz core-9951de4a10386a85dc1bfa465304cd0005414b8e.zip |
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'.
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/text/txtparai.cxx | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx index 721e03b14ebb..70848c42124e 100644 --- a/xmloff/source/text/txtparai.cxx +++ b/xmloff/source/text/txtparai.cxx @@ -2031,10 +2031,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 |