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)
committerLuca Bacci <luca.bacci982@gmail.com>
Mon, 29 May 2023 14:43:28 +0000 (16:43 +0200)
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 33e8c0542dffbe4d4f9ca6ac5422a58bb9a99c20..157b133c7eab840dd9007512408ecee6d18b0ab7 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;