[Libreoffice-commits] core.git: sw/qa writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Thu Nov 7 16:15:39 CET 2013


 sw/qa/extras/ooxmlexport/data/fdo70812.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx     |    6 ++++++
 writerfilter/source/dmapper/DomainMapper.cxx |    9 ++++++---
 3 files changed, 12 insertions(+), 3 deletions(-)

New commits:
commit 660d761bfeea81c0b76cf08b4c961a2ad8d09a06
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Nov 7 16:01:25 2013 +0100

    fdo#70812 writerfilter: check for nullptr after dynamic_cast
    
    Happens when we set "no number" in the default para style, which is
    already the case for Writer anyway.
    
    Change-Id: I3b262e633e52e4aae039c55d6edb744e36f0f354

diff --git a/sw/qa/extras/ooxmlexport/data/fdo70812.docx b/sw/qa/extras/ooxmlexport/data/fdo70812.docx
new file mode 100644
index 0000000..b9b5d52
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo70812.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index f96095d..cb379bb 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1562,6 +1562,12 @@ DECLARE_OOXML_TEST(testCp1000015, "cp1000015.odt")
     getParagraph(2, "http://www.google.com/");
 }
 
+DECLARE_OOXML_TEST(testFdo70812, "fdo70812.docx")
+{
+    // Import just crashed.
+    getParagraph(1, "Sample pages document.");
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index d2474bb..8a3f589 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1635,7 +1635,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
             {
                 //style sheets cannot have a numbering rule attached
                 StyleSheetPropertyMap* pStyleSheetPropertyMap = dynamic_cast< StyleSheetPropertyMap* >( rContext.get() );
-                pStyleSheetPropertyMap->SetListLevel( (sal_Int16)nIntValue );
+                if (pStyleSheetPropertyMap)
+                    pStyleSheetPropertyMap->SetListLevel( (sal_Int16)nIntValue );
             }
             else
                 rContext->Insert( PROP_NUMBERING_LEVEL, uno::makeAny( (sal_Int16)nIntValue ));
@@ -1649,7 +1650,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
             {
                 //style sheets cannot have a numbering rule attached
                 StyleSheetPropertyMap* pStyleSheetPropertyMap = dynamic_cast< StyleSheetPropertyMap* >( rContext.get() );
-                pStyleSheetPropertyMap->SetListId( nIntValue );
+                if (pStyleSheetPropertyMap)
+                    pStyleSheetPropertyMap->SetListId( nIntValue );
             }
             if( pList.get( ) )
             {
@@ -1667,7 +1669,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
                 {
                     // set the number id for AbstractNum references
                     StyleSheetPropertyMap* pStyleSheetPropertyMap = dynamic_cast< StyleSheetPropertyMap* >( rContext.get() );
-                    pStyleSheetPropertyMap->SetNumId( nIntValue );
+                    if (pStyleSheetPropertyMap)
+                        pStyleSheetPropertyMap->SetNumId( nIntValue );
                 }
                 else
                 {


More information about the Libreoffice-commits mailing list