sw/source/writerfilter/dmapper/PropertyMap.cxx |   27 +++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

New commits:
commit 7afb836b23c286eac4605ef4d98cf517f825b8d8
Author:     Caolán McNamara <[email protected]>
AuthorDate: Mon Nov 18 10:01:25 2024 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Mon Nov 18 12:13:59 2024 +0100

    crashtesting: crash on import of rtf exported from forum-en-32886.odt
    
    see: git diff -w
    Change-Id: Id50e45e53b7b433d6c468038a7de14441f4ee560
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176707
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/sw/source/writerfilter/dmapper/PropertyMap.cxx 
b/sw/source/writerfilter/dmapper/PropertyMap.cxx
index 66df3296a8bf..ce373b092890 100644
--- a/sw/source/writerfilter/dmapper/PropertyMap.cxx
+++ b/sw/source/writerfilter/dmapper/PropertyMap.cxx
@@ -1203,18 +1203,25 @@ void 
SectionPropertyMap::HandleMarginsHeaderFooter(DomainMapper_Impl& rDM_Impl)
     {
         rtl::Reference<SwXBaseStyle> xDefaultPageStyle =
                     rDM_Impl.GetPageStyles()->getStyleByName(u"Standard"_ustr);
-        for (const beans::Property& rProp : 
m_aPageStyle->getPropertySetInfo()->getProperties())
+        if (!m_aPageStyle)
         {
-            if (!rProp.Name.startsWith("Fill")) // only copy XATTR_FILL 
properties
-                continue;
-            try
-            {
-                const uno::Any aFillValue = 
xDefaultPageStyle->getPropertyValue(rProp.Name);
-                m_aPageStyle->setPropertyValue(rProp.Name, aFillValue);
-            }
-            catch (uno::Exception&)
+            SAL_WARN( "writerfilter", "No Page Style!" );
+        }
+        else
+        {
+            for (const beans::Property& rProp : 
m_aPageStyle->getPropertySetInfo()->getProperties())
             {
-                DBG_UNHANDLED_EXCEPTION("writerfilter", "Exception setting 
page background fill");
+                if (!rProp.Name.startsWith("Fill")) // only copy XATTR_FILL 
properties
+                    continue;
+                try
+                {
+                    const uno::Any aFillValue = 
xDefaultPageStyle->getPropertyValue(rProp.Name);
+                    m_aPageStyle->setPropertyValue(rProp.Name, aFillValue);
+                }
+                catch (uno::Exception&)
+                {
+                    DBG_UNHANDLED_EXCEPTION("writerfilter", "Exception setting 
page background fill");
+                }
             }
         }
     }

Reply via email to