sc/source/ui/dbgui/PivotLayoutDialog.cxx |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 9e51d871a641b355925fd65e62fe969b6c25e5c3
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Oct 27 16:07:15 2020 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Oct 27 21:49:16 2020 +0100

    avoid warning on set_active(0) on empty GtkComboBox
    
    i.e.
    
    gtk_tree_view_scroll_to_cell: assertion 'tree_view->priv->tree != NULL
    
    Change-Id: I48e7d015ec02ece407c732afebebb43c9c6fed48
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104896
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/source/ui/dbgui/PivotLayoutDialog.cxx 
b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
index 2263370a2eec..980d76504cef 100644
--- a/sc/source/ui/dbgui/PivotLayoutDialog.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
@@ -242,6 +242,8 @@ void ScPivotLayoutDialog::SetupSource()
         }
     }
 
+    bool bSourceBoxHasEntries = mxSourceListBox->get_count() > 0;
+
     if (bIsNamedRange)
     {
         mxSourceListBox->set_active_text(sSourceNamedRangeName);
@@ -249,12 +251,13 @@ void ScPivotLayoutDialog::SetupSource()
     }
     else
     {
-        mxSourceListBox->set_active(0);
+        // If entries - select first entry
+        mxSourceListBox->set_active(bSourceBoxHasEntries ? 0 : -1);
         mxSourceRadioSelection->set_active(true);
     }
 
-    // If entries - select first entry, otherwise disable the radio button.
-    if (mxSourceListBox->get_count() <= 0)
+    // If no entries disable the radio button.
+    if (!bSourceBoxHasEntries)
         mxSourceRadioNamedRange->set_sensitive(false);
 
     ToggleSource();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to