about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/xmpp/message.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index 033a7a11..8a711e90 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -1008,6 +1008,13 @@ _handle_carbons(xmpp_stanza_t *const stanza)
     Jid *jid_from = jid_create(from);
     Jid *jid_to = jid_create(to);
 
+    if (!message->plain && !message->body) {
+        log_error("Message received without body from: %s", jid_from->fulljid);
+        goto out;
+    } else if (!message->plain) {
+        message->plain = strdup(message->body);
+    }
+
     // check for pgp encrypted message
     xmpp_stanza_t *x = xmpp_stanza_get_child_by_ns(message_stanza, STANZA_NS_ENCRYPTED);
     if (x) {
@@ -1029,9 +1036,9 @@ _handle_carbons(xmpp_stanza_t *const stanza)
         }
     }
 
+out:
     message_free(message);
     jid_destroy(my_jid);
-
     return TRUE;
 }