[Libreoffice-commits] core.git: 2 commits - svl/source sw/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 28 08:51:45 UTC 2021


 svl/source/items/itemset.cxx       |   12 +++++++++++-
 sw/source/core/txtnode/atrfld.cxx  |    5 ++++-
 sw/source/core/txtnode/fmtatr2.cxx |    5 ++++-
 3 files changed, 19 insertions(+), 3 deletions(-)

New commits:
commit c06f05e28cb66bd2aac5ea65bcfa3732808c51c6
Author:     Michael Stahl <michael.stahl at allotropia.de>
AuthorDate: Tue Apr 27 19:22:52 2021 +0200
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Wed Apr 28 10:51:19 2021 +0200

    svl: fix crash in SfxItemSet::dumpAsXml()
    
    Change-Id: I64cb14a740d6874ce288f249953984116648a470
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114759
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index dea82de88d64..b234543a28f4 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -1531,7 +1531,17 @@ void SfxItemSet::dumpAsXml(xmlTextWriterPtr pWriter) const
     (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SfxItemSet"));
     SfxItemIter aIter(*this);
     for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
-         pItem->dumpAsXml(pWriter);
+    {
+        if (IsInvalidItem(pItem))
+        {
+            (void)xmlTextWriterStartElement(pWriter, BAD_CAST("invalid"));
+            (void)xmlTextWriterEndElement(pWriter);
+        }
+        else
+        {
+            pItem->dumpAsXml(pWriter);
+        }
+    }
     (void)xmlTextWriterEndElement(pWriter);
 }
 
commit d12acfa1405fa5b7c11d2a517286da68b3fd2eff
Author:     Michael Stahl <michael.stahl at allotropia.de>
AuthorDate: Tue Apr 27 19:11:58 2021 +0200
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Wed Apr 28 10:51:07 2021 +0200

    sw: fix crash in SwFormatAutoFormat::dumpAsXml()
    
    Change-Id: Ib2d723b34d8e6f1254f5a9b0d0be509daf24ce43
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114758
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>

diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index 36151899db9a..558874ad1784 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -410,7 +410,10 @@ void SwFormatField::dumpAsXml(xmlTextWriterPtr pWriter) const
     (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("mpTextField"), "%p", mpTextField);
 
     SfxPoolItem::dumpAsXml(pWriter);
-    mpField->dumpAsXml(pWriter);
+    if (mpField) // pool default doesn't have one
+    {
+        mpField->dumpAsXml(pWriter);
+    }
 
     (void)xmlTextWriterEndElement(pWriter);
 }
diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx
index ff04d9bb0ed9..73eb992c5c97 100644
--- a/sw/source/core/txtnode/fmtatr2.cxx
+++ b/sw/source/core/txtnode/fmtatr2.cxx
@@ -143,7 +143,10 @@ void SwFormatAutoFormat::dumpAsXml(xmlTextWriterPtr pWriter) const
     (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwFormatAutoFormat"));
     (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
     (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
-    mpHandle->dumpAsXml(pWriter);
+    if (mpHandle) // pool default doesn't have one
+    {
+        mpHandle->dumpAsXml(pWriter);
+    }
     (void)xmlTextWriterEndElement(pWriter);
 }
 


More information about the Libreoffice-commits mailing list