Check for NULL groups in gtk_action_muxer_get_group ()
authorLuca Bacci <luca.bacci982@gmail.com>
Wed, 17 May 2023 12:00:56 +0000 (14:00 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 5 Jun 2023 12:00:43 +0000 (08:00 -0400)
The groups hash table is initialized lazily when inserting
the first GActionGroup (gtk_action_muxer_insert ()). Do as
all surrounding code does and check for NULL before using
groups.

This avoids triggering a warning

gtk/gtkactionmuxer.c

index 760f796354557da1292ffdd2ea6c498c11575410..47aaf0c92c7887013faeb5675054de605df20c3d 100644 (file)
@@ -325,6 +325,9 @@ gtk_action_muxer_get_group (GtkActionMuxer *muxer,
 {
   Group *group;
 
+  if (!muxer->groups)
+    return NULL;
+
   group = g_hash_table_lookup (muxer->groups, group_name);
   if (group)
     return group->group;