sc/source/ui/cctrl/checklistmenu.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 753f5d65b4a91e179c61eeea2645ae190eb80155
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Nov 17 10:48:59 2021 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Nov 17 13:42:52 2021 +0100

    don't attempt to set cursor to first entry if there are no entries
    
    avoids gtk warning of:
    gtk_tree_view_scroll_to_cell: assertion 'tree_view->priv->tree != NULL
    
    Change-Id: Ie2c22a02d795591600a7f6da2e11741ba084a81f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125380
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/source/ui/cctrl/checklistmenu.cxx 
b/sc/source/ui/cctrl/checklistmenu.cxx
index 5fcfa27c0c1b..56fb60477220 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -623,8 +623,11 @@ void ScCheckListMenuControl::prepWindow()
 {
     mxMenu->set_size_request(-1, mxMenu->get_preferred_size().Height() + 2);
     mnSelectedMenu = 0;
-    mxMenu->set_cursor(mnSelectedMenu);
-    mxMenu->unselect_all();
+    if (mxMenu->n_children())
+    {
+        mxMenu->set_cursor(mnSelectedMenu);
+        mxMenu->unselect_all();
+    }
 
     mnWndWidth = mxContainer->get_preferred_size().Width() + 
mxFrame->get_border_width() * 2 + 4;
 }

Reply via email to