[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - xmloff/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 4 23:12:24 UTC 2020


 xmloff/source/style/PageMasterExportPropMapper.cxx |   25 +++++++++++----------
 1 file changed, 14 insertions(+), 11 deletions(-)

New commits:
commit 69eb1bb950d09c8edfc78f980c21645c88ac408e
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Jun 4 13:28:33 2020 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Fri Jun 5 01:11:48 2020 +0200

    xmloff: ODF export: fix crash on tdf125455-2.odt
    
    FillBitmapMode is a very funny property that is stored as 2 items
    XFillBmpTileItem XATTR_FILLBMP_TILE and
    XFillBmpStretchItem XATTR_FILLBMP_STRETCH
    and the XPropertySet implementations for it are a bit inconsistent,
    e.g. sd uses .GetItem<XFillBmpStretchItem> which searches the parent
    and requires both items to be present,
    but sw uses GetItemState(XATTR_FILLBMP_STRETCH, false) which does not
    check the parent and one item is enough.
    
    Let's just not export the attribute in case the property isn't defined.
    
    (regression from 4d4404b79bf051de79f587bdafd82cc0addfc636)
    
    Change-Id: I13c2e91c3e4eb15ebec508f679ba49614f493a11
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95501
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    (cherry picked from commit c87ed105f17ce68842cfacddf96a9082feb9981c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95428
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/xmloff/source/style/PageMasterExportPropMapper.cxx b/xmloff/source/style/PageMasterExportPropMapper.cxx
index 22078b2376a1..9c20a6a2b70e 100644
--- a/xmloff/source/style/PageMasterExportPropMapper.cxx
+++ b/xmloff/source/style/PageMasterExportPropMapper.cxx
@@ -591,19 +591,22 @@ void XMLPageMasterExportPropMapper::ContextFilter(
                 backgroundSize <<= true;
                 break;
             case drawing::FillStyle_BITMAP:
-                assert(pFillBitmapMode);
-                switch (pFillBitmapMode->maValue.get<drawing::BitmapMode>())
+                if (pFillBitmapMode)
                 {
-                    case drawing::BitmapMode_REPEAT:
-                        backgroundSize <<= true;
-                        break;
-                    case drawing::BitmapMode_STRETCH:
-                    case drawing::BitmapMode_NO_REPEAT:
-                        backgroundSize <<= false;
-                        break;
-                    default:
-                        assert(false);
+                    switch (pFillBitmapMode->maValue.get<drawing::BitmapMode>())
+                    {
+                        case drawing::BitmapMode_REPEAT:
+                            backgroundSize <<= true;
+                            break;
+                        case drawing::BitmapMode_STRETCH:
+                        case drawing::BitmapMode_NO_REPEAT:
+                            backgroundSize <<= false;
+                            break;
+                        default:
+                            assert(false);
+                    }
                 }
+                // else: leave it ambiguous if not explicitly defined
                 break;
             default:
                 assert(false);


More information about the Libreoffice-commits mailing list