about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-07-21 22:23:28 +0100
committerJames Booth <boothj5@gmail.com>2016-07-21 22:23:28 +0100
commitd2e237203ca55a0d947abab8aa312f7fbbd5a49c (patch)
treec46fd708ac3cff06c29718c3bb6773f944c745fb
parentb68d2ce106fa0ef9365dc2902201f4dce72fd978 (diff)
downloadprofani-tty-d2e237203ca55a0d947abab8aa312f7fbbd5a49c.tar.gz
Check for win callback hash before removing
-rw-r--r--src/plugins/callbacks.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/plugins/callbacks.c b/src/plugins/callbacks.c
index 1ac4c5b9..c7ea471b 100644
--- a/src/plugins/callbacks.c
+++ b/src/plugins/callbacks.c
@@ -159,13 +159,15 @@ callbacks_remove(const char *const plugin_name)
     g_hash_table_remove(p_timed_functions, plugin_name);
 
     GHashTable *tag_to_win_cb_hash = g_hash_table_lookup(p_window_callbacks, plugin_name);
-    GList *tags = g_hash_table_get_keys(tag_to_win_cb_hash);
-    GList *curr = tags;
-    while (curr) {
-        wins_close_plugin(curr->data);
-        curr = g_list_next(curr);
+    if (tag_to_win_cb_hash) {
+        GList *tags = g_hash_table_get_keys(tag_to_win_cb_hash);
+        GList *curr = tags;
+        while (curr) {
+            wins_close_plugin(curr->data);
+            curr = g_list_next(curr);
+        }
+        g_list_free(tags);
     }
-    g_list_free(tags);
 
     g_hash_table_remove(p_window_callbacks, plugin_name);
 }