chart2/source/controller/dialogs/ChartTypeDialogController.cxx |   15 
++++++----
 1 file changed, 9 insertions(+), 6 deletions(-)

New commits:
commit b502698c08cab2a73c10147b32a35532ab615dcb
Author:     Miklos Vajna <[email protected]>
AuthorDate: Thu Jan 22 14:54:44 2026 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Fri Jan 23 10:01:29 2026 +0100

    chart2: fix crash in OfPieChartDialogController::fillExtraControls()
    
    gdb backtrace on the core file:
    
            #8  chart::OfPieChartDialogController::fillExtraControls 
(this=0x23c15020, xChartModel=..., xTemplateProps=...)
                at 
chart2/source/controller/dialogs/ChartTypeDialogController.cxx:841
            #9  0x0000719b38a2076f in chart::ChartTypeTabPage::selectMainType 
(this=0x23948420)
                at chart2/source/controller/dialogs/tp_ChartType.cxx:272
            #10 0x0000719b3b656103 in Link<weld::TreeView&, void>::Call 
(data=..., this=0x1fd52058)
                at include/tools/link.hxx:111
    
    and:
    
            (gdb) print aValuesSeries
            $1 = std::vector of length 0, capacity 0
    
    But leave the assert in place, so we have a chance to find the deeper
    problem in a debug build.
    
    Change-Id: Ic590c777a0a6fbe5fd188b6600c1de908c9a0910
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197828
    Reviewed-by: Caolán McNamara <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Tested-by: Caolán McNamara <[email protected]>

diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx 
b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
index a2d4f2918286..377bed719807 100644
--- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
@@ -838,14 +838,17 @@ void OfPieChartDialogController::fillExtraControls(
 
         assert(!aValuesSeries.empty());
 
-        const uno::Reference< chart2::data::XDataSequence > xSeq( 
aValuesSeries.front()->getValues() );
+        if (!aValuesSeries.empty())
+        {
+            const uno::Reference< chart2::data::XDataSequence > xSeq( 
aValuesSeries.front()->getValues() );
 
-        // Allow all but one entry to be aggregated in the composite wedge
-        sal_Int32 nMaxCompositeSize = xSeq->getData().getLength() - 1;
+            // Allow all but one entry to be aggregated in the composite wedge
+            sal_Int32 nMaxCompositeSize = xSeq->getData().getLength() - 1;
 
-        if( nMaxCompositeSize < 2 )
-            nMaxCompositeSize = 2;
-        m_xMF_CompositeSize->set_max(nMaxCompositeSize);
+            if( nMaxCompositeSize < 2 )
+                nMaxCompositeSize = 2;
+            m_xMF_CompositeSize->set_max(nMaxCompositeSize);
+        }
     }
 }
 

Reply via email to