chart2/source/controller/main/ControllerCommandDispatch.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit d0c5f49cc99eaec77071830dee3dc5284fffb925
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Mon Jun 23 13:02:49 2025 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Thu Jun 26 15:16:19 2025 +0200

    crash on deref xProperties[0]
    
     #0  0x00007d2c10cfed96 in 
chart::ControllerCommandDispatch::updateCommandAvailability (this=0x3de34be0)
         at chart2/source/controller/main/ControllerCommandDispatch.cxx:812
     #1  0x00007d2c10d01e7c in chart::ControllerCommandDispatch::modified 
(this=0x3de34be0, aEvent=...)
         at chart2/source/controller/main/ControllerCommandDispatch.cxx:1056
     #2  0x00007d2c10e4baa1 in 
comphelper::OInterfaceContainerHelper4<com::sun::star::util::XModifyListener>::NotifySingleListener<com::sun::star::lang::EventObject>::operator()
 (listener=...,
         this=0x7ffce60d8250) at include/comphelper/interfacecontainer4.hxx:319
     #3  
comphelper::OInterfaceContainerHelper4<com::sun::star::util::XModifyListener>::forEach<comphelper::OInterfaceContainerHelper4<com::sun::star::util::XModifyListener>::NotifySingleListener<com::sun::star::lang::EventObject>
 > (this=<optimized out>, rGuard=..., func=...) at 
include/comphelper/interfacecontainer4.hxx:349
     #4  0x00007d2c10e46ad4 in 
comphelper::OInterfaceContainerHelper4<com::sun::star::util::XModifyListener>::notifyEach<com::sun::star::lang::EventObject>
 (Event=...,
         NotificationMethod=&virtual 
com::sun::star::util::XModifyListener::modified(com::sun::star::lang::EventObject
 const&), rGuard=..., this=0x3d096fa8)
         at include/comphelper/interfacecontainer4.hxx:409
     #5  chart::ChartModel::impl_notifyModifiedListeners (this=0x3d096e70) at 
chart2/source/model/main/ChartModel_Persistence.cxx:624
     #6  0x00007d2c10e46c5c in chart::ChartModel::setModified (this=0x3d096e70, 
bModified=<optimized out>)
        at chart2/source/model/main/ChartModel_Persistence.cxx:660
    
    (gdb) print xProperties[0]
    $3 = {<com::sun::star::uno::BaseReference> = {_pInterface = 0x0}, <No data 
fields>}
    
    Change-Id: I5225b24dcdeecd2e85e1f892f6b6463c0122fbce
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187033
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins

diff --git a/chart2/source/controller/main/ControllerCommandDispatch.cxx 
b/chart2/source/controller/main/ControllerCommandDispatch.cxx
index 4d2fab63ff88..9b1dce5ff6d5 100644
--- a/chart2/source/controller/main/ControllerCommandDispatch.cxx
+++ b/chart2/source/controller/main/ControllerCommandDispatch.cxx
@@ -78,17 +78,20 @@ bool lcl_isStatusBarVisible( const Reference< 
frame::XController > & xController
 }
 
 bool lcl_arePropertiesSame(std::vector<Reference<beans::XPropertySet>>& 
xProperties,
-                           OUString& aPropName)
+                           const OUString& aPropName)
 {
     if (xProperties.size() == 1)
         return true;
     if (xProperties.size() < 1)
         return false;
 
+    if (!xProperties[0])
+        return false;
+
     uno::Any aValue = xProperties[0]->getPropertyValue(aPropName);
     for (std::size_t i = 1; i < xProperties.size(); i++)
     {
-        if (aValue != xProperties[i]->getPropertyValue(aPropName))
+        if (xProperties[i] && aValue != 
xProperties[i]->getPropertyValue(aPropName))
             return false;
     }
     return true;

Reply via email to