mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Merge pull request #1132 from paulfariello/hotfix/muc-history-segfault
Fix NULL pointer when handling non encrypted message in MUC
This commit is contained in:
commit
4b62f8f2ba
@ -800,6 +800,8 @@ _handle_groupchat(xmpp_stanza_t *const stanza)
|
||||
message->jid = jid;
|
||||
message->id = strdup(id);
|
||||
|
||||
message->body = xmpp_message_get_body(stanza);
|
||||
|
||||
// check omemo encryption
|
||||
#ifdef HAVE_OMEMO
|
||||
message->plain = omemo_receive_message(stanza, &message->trusted);
|
||||
@ -808,7 +810,12 @@ _handle_groupchat(xmpp_stanza_t *const stanza)
|
||||
}
|
||||
#endif
|
||||
|
||||
message->body = xmpp_message_get_body(stanza);
|
||||
if (!message->plain && !message->body) {
|
||||
log_error("Message received without body for room: %s", jid->str);
|
||||
goto out;
|
||||
} else if (!message->plain) {
|
||||
message->plain = strdup(message->body);
|
||||
}
|
||||
|
||||
// determine if the notifications happened whilst offline
|
||||
message->timestamp = stanza_get_delay(stanza);
|
||||
@ -818,6 +825,7 @@ _handle_groupchat(xmpp_stanza_t *const stanza)
|
||||
sv_ev_room_message(message);
|
||||
}
|
||||
|
||||
out:
|
||||
message_free(message);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user