about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-06-01 22:41:17 +0100
committerJames Booth <boothj5@gmail.com>2016-06-01 22:41:17 +0100
commit086fd30e2399dcca8a75a71f0bac4a8852f2de46 (patch)
tree80a69f9c6cd36677c53f579dc3e0272f74451b70
parent784d9642bc56c9d88f3d9a0df87b3e29614d2054 (diff)
downloadprofani-tty-086fd30e2399dcca8a75a71f0bac4a8852f2de46.tar.gz
Check for NULL before clearing connection data
-rw-r--r--src/xmpp/connection.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c
index ffabc149..07b528ef 100644
--- a/src/xmpp/connection.c
+++ b/src/xmpp/connection.c
@@ -216,10 +216,14 @@ connection_set_disconnected(void)
 void
 connection_clear_data(void)
 {
-    g_hash_table_destroy(conn.features_by_jid);
-    conn.features_by_jid = NULL;
+    if (conn.features_by_jid) {
+        g_hash_table_destroy(conn.features_by_jid);
+        conn.features_by_jid = NULL;
+    }
 
-    g_hash_table_remove_all(conn.available_resources);
+    if (conn.available_resources) {
+        g_hash_table_remove_all(conn.available_resources);
+    }
 }
 
 #ifdef HAVE_LIBMESODE