Merge pull request #1136 from paulfariello/hotfix/segfault_on_empty_carbon

Fix a segfault when carbon has no body
This commit is contained in:
Michael Vetter
2019-06-21 17:03:23 +02:00
committed by GitHub

View File

@@ -1004,6 +1004,7 @@ _handle_carbons(xmpp_stanza_t *const stanza)
message->encrypted = xmpp_stanza_get_text(x); message->encrypted = xmpp_stanza_get_text(x);
} }
if (message->plain || message->encrypted || message->body) {
// if we are the recipient, treat as standard incoming message // if we are the recipient, treat as standard incoming message
if (g_strcmp0(my_jid->barejid, jid_to->barejid) == 0) { if (g_strcmp0(my_jid->barejid, jid_to->barejid) == 0) {
jid_destroy(jid_to); jid_destroy(jid_to);
@@ -1016,6 +1017,7 @@ _handle_carbons(xmpp_stanza_t *const stanza)
message->jid = jid_to; message->jid = jid_to;
sv_ev_outgoing_carbon(message); sv_ev_outgoing_carbon(message);
} }
}
message_free(message); message_free(message);
jid_destroy(my_jid); jid_destroy(my_jid);