[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Mon Nov 11 13:18:36 PST 2013


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

New commits:
commit 88cb2a731bf445776adb6c047010bbd0dae3c633
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.
    
    (cherry picked from commit 660d761bfeea81c0b76cf08b4c961a2ad8d09a06)
    
    Conflicts:
    	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
    
    Change-Id: I3b262e633e52e4aae039c55d6edb744e36f0f354
    Reviewed-on: https://gerrit.libreoffice.org/6636
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

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 7983360..c1bb45e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -76,6 +76,7 @@ public:
     void testFdo60990();
     void testBnc834035();
     void testCp1000015();
+    void testFdo70812();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -136,6 +137,7 @@ void Test::run()
         {"fdo60990.odt", &Test::testFdo60990},
         {"bnc834035.odt", &Test::testBnc834035},
         {"cp1000015.odt", &Test::testCp1000015},
+        {"fdo70812.docx", &Test::testFdo70812},
     };
     // Don't test the first import of these, for some reason those tests fail
     const char* aBlacklist[] = {
@@ -781,6 +783,12 @@ void Test::testCp1000015()
     getParagraph(2, "http://www.google.com/");
 }
 
+void Test::testFdo70812()
+{
+    // Import just crashed.
+    getParagraph(1, "Sample pages document.");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 5ac4b05..dfcf3a7 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1561,7 +1561,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, true, uno::makeAny( (sal_Int16)nIntValue ));
@@ -1575,7 +1576,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( ) )
             {
@@ -1593,7 +1595,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