about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2021-03-25 11:34:14 +0100
committerMichael Vetter <jubalh@iodoru.org>2021-03-25 11:34:14 +0100
commite656bdb83cee144fe243b4eacd9fe8a0768c19be (patch)
treef7f94abbfc13fe2e90f1da6410ba0f17289b96dd /src
parent2ea08fd99477f775c3f88620a13181eba72a7239 (diff)
downloadprofani-tty-e656bdb83cee144fe243b4eacd9fe8a0768c19be.tar.gz
message: fix possible segfault in _message_handler
Diffstat (limited to 'src')
-rw-r--r--src/xmpp/message.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index 54be543c..a88956f9 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -162,12 +162,12 @@ _message_handler(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void* con
     // type according to RFC 6121
     const char* type = xmpp_stanza_get_type(stanza);
 
-    if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) {
+    if (type && g_strcmp0(type, STANZA_TYPE_ERROR) == 0) {
         _handle_error(stanza);
-    } else if (g_strcmp0(type, STANZA_TYPE_GROUPCHAT) == 0) {
+    } else if (type && g_strcmp0(type, STANZA_TYPE_GROUPCHAT) == 0) {
         // XEP-0045: Multi-User Chat
         _handle_groupchat(stanza);
-    } else if (g_strcmp0(type, STANZA_TYPE_HEADLINE) == 0) {
+    } else if (type && g_strcmp0(type, STANZA_TYPE_HEADLINE) == 0) {
         _handle_headline(stanza);
     } else if (type == NULL || g_strcmp0(type, STANZA_TYPE_CHAT) != 0 || g_strcmp0(type, STANZA_TYPE_NORMAL) != 0) {
         // type: chat, normal (==NULL)