[Libreoffice-commits] .: Branch 'libreoffice-3-5' - xmloff/source

Jan Holesovsky kendy at kemper.freedesktop.org
Mon Feb 13 04:09:35 PST 2012


 xmloff/source/text/txtparai.cxx |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 86a03eb68e395410143f892110b0e40ccdded0c2
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Fri Feb 10 17:54:03 2012 +0100

    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 at suse.com>

diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index 66d8f00..30c364d 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


More information about the Libreoffice-commits mailing list