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

New commits:
commit 6126ef73a40675943b882f3e5b5e6c155485e68d
Author:     Miklos Vajna <[email protected]>
AuthorDate: Thu Jan 22 14:54:44 2026 +0100
Commit:     Miklos Vajna <[email protected]>
CommitDate: Fri Jan 23 12:18:49 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/+/197926
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins

diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx 
b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
index 3bf0de139659..85ebcd9e0ebc 100644
--- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
@@ -746,14 +746,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