[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - svx/source

Szymon Kłos (via logerrit) logerrit at kemper.freedesktop.org
Tue Nov 12 10:42:22 UTC 2019


 svx/source/svdraw/svdedtv1.cxx |   23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

New commits:
commit a7d69c50f6f2918a255df9f2ad395e26395b8f63
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Nov 12 10:43:53 2019 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Nov 12 11:41:17 2019 +0100

    Avoid nullptr dereference
    
    Conditions already present on master
    
    Change-Id: I527482521191e51340f19f601f03d94fce50d429
    Reviewed-on: https://gerrit.libreoffice.org/82490
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index 3a325152d4dd..7ccaf13d5b63 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -938,20 +938,26 @@ void SdrEditView::MergeAttrFromMarked(SfxItemSet& rAttr, bool bOnlyHardAttr) con
                     case XATTR_LINECOLOR:
                     {
                         const SfxPoolItem* pItem = rSet.GetItem(XATTR_LINECOLOR);
-                        Color aColor = static_cast<const XLineColorItem*>(pItem)->GetColorValue();
-                        sPayload = OUString::number(static_cast<sal_uInt32>(aColor));
+                        if (pItem)
+                        {
+                            Color aColor = static_cast<const XLineColorItem*>(pItem)->GetColorValue();
+                            sPayload = OUString::number(static_cast<sal_uInt32>(aColor));
 
-                        sPayload = ".uno:XLineColor=" + sPayload;
+                            sPayload = ".uno:XLineColor=" + sPayload;
+                        }
                         break;
                     }
 
                     case XATTR_FILLCOLOR:
                     {
                         const SfxPoolItem* pItem = rSet.GetItem(XATTR_FILLCOLOR);
-                        Color aColor = static_cast<const XFillColorItem*>(pItem)->GetColorValue();
-                        sPayload = OUString::number(static_cast<sal_uInt32>(aColor));
+                        if (pItem)
+                        {
+                            Color aColor = static_cast<const XFillColorItem*>(pItem)->GetColorValue();
+                            sPayload = OUString::number(static_cast<sal_uInt32>(aColor));
 
-                        sPayload = ".uno:FillColor=" + sPayload;
+                            sPayload = ".uno:FillColor=" + sPayload;
+                        }
                         break;
                     }
 
@@ -969,8 +975,9 @@ void SdrEditView::MergeAttrFromMarked(SfxItemSet& rAttr, bool bOnlyHardAttr) con
                     }
                 }
 
-                GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
-                    OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US).getStr());
+                if (!sPayload.isEmpty())
+                    GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
+                        OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US).getStr());
             }
 
             nWhich = aIter.NextWhich();


More information about the Libreoffice-commits mailing list