chart2/source/controller/main/ChartController.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 3a226b94a97ce4b670c3b6daf6f48c83deb0d52f
Author:     Andras Timar <[email protected]>
AuthorDate: Sun Mar 1 18:15:50 2026 +0100
Commit:     Miklos Vajna <[email protected]>
CommitDate: Mon Mar 2 15:20:51 2026 +0100

    Fix SIGSEGV in ChartController::getFirstDiagram with null model
    
    getFirstDiagram() unconditionally dereferences getChartModel()
    without checking for null. In a multi-view LOKit scenario, the chart
    model can be detached while an async dialog (e.g. InsertRemoveAxes)
    is open. When the dialog callback fires, getChartModel() returns null
    and the subsequent ->getFirstChartDiagram() dereferences it,
    crashing at offset 0x280.
    
    Add a null check for the model before dereferencing.
    
    Change-Id: Iabd7efd1d752c28cdcc9182669797b863a7a5306
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200726
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/chart2/source/controller/main/ChartController.cxx 
b/chart2/source/controller/main/ChartController.cxx
index ca1ff7dadc6d..e051bb49f8eb 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -636,7 +636,10 @@ rtl::Reference<::chart::ChartModel> 
ChartController::getChartModel()
 
 rtl::Reference<::chart::Diagram> ChartController::getFirstDiagram()
 {
-    return getChartModel()->getFirstChartDiagram();
+    rtl::Reference<::chart::ChartModel> xModel = getChartModel();
+    if (!xModel)
+        return nullptr;
+    return xModel->getFirstChartDiagram();
 }
 
 uno::Any SAL_CALL ChartController::getViewData()

Reply via email to