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:
parent
e0626ada2f
commit
9951de4a10
1 changed files with 10 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue