changeset 2219:3958793d0d03

otr_send: Fix my previous fix and abort if the initial message is empty
author Mikael Berthe <mikael@lilotux.net>
date Thu, 05 Nov 2015 23:34:23 +0100
parents b56be18d5a04
children 79e12dacbccd
files mcabber/mcabber/otr.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/mcabber/otr.c	Thu Nov 05 23:29:59 2015 +0100
+++ b/mcabber/mcabber/otr.c	Thu Nov 05 23:34:23 2015 +0100
@@ -613,9 +613,12 @@
   char *htmlmsg, *rmsg;
   ConnContext *ctx = otr_get_context(buddy);
 
+  if (!encryption_status)
+    return NULL;
+
   *encryption_status = 0;
 
-  if (!msg || !buddy || !*encryption_status)
+  if (!buddy || !msg || !msg[0])
     return NULL;
 
   if (ctx->msgstate == OTRL_MSGSTATE_PLAINTEXT)
@@ -660,7 +663,7 @@
   }
 
   /* Check the new message is not empty */
-  if (newmessage[0] || !msg[0]) {
+  if (newmessage[0]) {
     rmsg = g_strdup(newmessage);
   } else {
     rmsg = NULL;