summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-10-27 16:07:15 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-10-27 21:49:16 +0100
commit9e51d871a641b355925fd65e62fe969b6c25e5c3 (patch)
tree8304ee032e3904a9cbf49fa147f0df7bf200239f /sc
parent181f19995d7c2c9759365ab664732504b2496063 (diff)
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 <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/dbgui/PivotLayoutDialog.cxx9
1 files changed, 6 insertions, 3 deletions
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();