about summary refs log tree commit diff stats
path: root/src/event
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2021-03-05 12:31:27 +0100
committerMichael Vetter <jubalh@iodoru.org>2021-03-05 12:31:27 +0100
commit8190301a6780c5d1cab2c7dcf70546c0aaff7cd2 (patch)
tree17cc94df177774a32a72e95159d79678b1f0be11 /src/event
parentf025bceda30b0583165e8187b91191b0f757756c (diff)
downloadprofani-tty-8190301a6780c5d1cab2c7dcf70546c0aaff7cd2.tar.gz
Prevent segfault in sv_ev_incoming_message()
Regards https://github.com/profanity-im/profanity/issues/1488

Actually I would have loved to see the stanza that caused the segfault
since I'm not entirely sure whether this actually means that we do
something wrong earlier on.

Right now I don't know why the to_jid should be empty.

Let's prevent the segfault for now and see whether we get further
bugreports later.

Segfaulting issue got introduced with dd566d8d561099bbfc81b2fab22318bbad0cf3da.
Diffstat (limited to 'src/event')
-rw-r--r--src/event/server_events.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/event/server_events.c b/src/event/server_events.c
index 7cafd4df..d297b103 100644
--- a/src/event/server_events.c
+++ b/src/event/server_events.c
@@ -600,7 +600,9 @@ sv_ev_incoming_message(ProfMessage* message)
     if (message->is_mam) {
         char* mybarejid = connection_get_barejid();
         if (g_strcmp0(mybarejid, message->from_jid->barejid) == 0) {
-            looking_for_jid = message->to_jid->barejid;
+            if (message->to_jid) {
+                looking_for_jid = message->to_jid->barejid;
+            }
         }
         free(mybarejid);
     }