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'.
This commit is contained in:
Jan Holesovsky 2012-02-10 17:54:03 +01:00
parent e0626ada2f
commit 9951de4a10

View file

@ -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