diff options
author | Michael Vetter <jubalh@iodoru.org> | 2022-07-04 16:45:18 +0200 |
---|---|---|
committer | Michael Vetter <jubalh@iodoru.org> | 2022-07-04 16:58:16 +0200 |
commit | c8b2979dcda8cca3052164ae9bfd09adbf7523fc (patch) | |
tree | 318417e5bce928f8d40e73539443495f72e313ce /src/ui | |
parent | f30999fd51d2362df01294c8c40cadc746acb9b7 (diff) | |
download | profani-tty-c8b2979dcda8cca3052164ae9bfd09adbf7523fc.tar.gz |
Exit *_incoming_msg functions when plain message is empty
Fix https://github.com/profanity-im/profanity/issues/1733
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/chatwin.c | 6 | ||||
-rw-r--r-- | src/ui/mucwin.c | 5 | ||||
-rw-r--r-- | src/ui/privwin.c | 6 |
3 files changed, 17 insertions, 0 deletions
diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c index c7cf8ddb..32fd3553 100644 --- a/src/ui/chatwin.c +++ b/src/ui/chatwin.c @@ -310,6 +310,12 @@ void chatwin_incoming_msg(ProfChatWin* chatwin, ProfMessage* message, gboolean win_created) { assert(chatwin != NULL); + + if (message->plain == NULL) { + log_error("chatwin_incoming_msg: Message with no plain field from: %s", message->from_jid); + return; + } + char* old_plain = message->plain; message->plain = plugins_pre_chat_message_display(message->from_jid->barejid, message->from_jid->resourcepart, message->plain); diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c index b48a4a54..3c4d7447 100644 --- a/src/ui/mucwin.c +++ b/src/ui/mucwin.c @@ -551,6 +551,11 @@ mucwin_incoming_msg(ProfMucWin* mucwin, const ProfMessage* const message, GSList assert(mucwin != NULL); int flags = 0; + if (message->plain == NULL) { + log_error("mucwin_incoming_msg: Message with no plain field from: %s", message->from_jid); + return; + } + if (filter_reflection && message_is_sent_by_us(message, TRUE)) { /* Ignore reflection messages */ return; diff --git a/src/ui/privwin.c b/src/ui/privwin.c index 20611ea4..b683a839 100644 --- a/src/ui/privwin.c +++ b/src/ui/privwin.c @@ -39,6 +39,7 @@ #include <glib.h> #include <stdlib.h> +#include "log.h" #include "config/preferences.h" #include "ui/win_types.h" #include "ui/window.h" @@ -50,6 +51,11 @@ privwin_incoming_msg(ProfPrivateWin* privatewin, ProfMessage* message) { assert(privatewin != NULL); + if (message->plain == NULL) { + log_error("privwin_incoming_msg: Message with no plain field from: %s", message->from_jid); + return; + } + ProfWin* window = (ProfWin*)privatewin; int num = wins_get_num(window); |