about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/otr/otrlibv3.c5
-rw-r--r--src/otr/otrlibv4.c4
-rw-r--r--src/ui/chatwin.c9
-rw-r--r--src/ui/ui.h2
-rw-r--r--tests/unittests/ui/stub_ui.c2
5 files changed, 13 insertions, 9 deletions
diff --git a/src/otr/otrlibv3.c b/src/otr/otrlibv3.c
index 3fb85e0e..b12abbff 100644
--- a/src/otr/otrlibv3.c
+++ b/src/otr/otrlibv3.c
@@ -217,7 +217,10 @@ otrlib_handle_tlvs(OtrlUserState user_state, OtrlMessageAppOps *ops, ConnContext
     tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP_ABORT);
     if (tlv) {
         context->smstate->nextExpected = OTRL_SMP_EXPECT1;
-        ui_smp_aborted(context->username);
+        ProfChatWin *chatwin = wins_get_chat(context->username);
+        if (chatwin) {
+            ui_smp_aborted(chatwin);
+        }
         ui_untrust(context->username);
         otr_untrust(context->username);
     }
diff --git a/src/otr/otrlibv4.c b/src/otr/otrlibv4.c
index acce648e..089585fb 100644
--- a/src/otr/otrlibv4.c
+++ b/src/otr/otrlibv4.c
@@ -229,7 +229,9 @@ cb_handle_smp_event(void *opdata, OtrlSMPEvent smp_event,
             break;
 
         case OTRL_SMPEVENT_ABORT:
-            ui_smp_aborted(context->username);
+            if (chatwin) {
+                ui_smp_aborted(chatwin);
+            }
             ui_untrust(context->username);
             break;
 
diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c
index 35e50af1..a5b2a9be 100644
--- a/src/ui/chatwin.c
+++ b/src/ui/chatwin.c
@@ -140,12 +140,11 @@ ui_smp_unsuccessful_receiver(ProfChatWin *chatwin)
 }
 
 void
-ui_smp_aborted(const char *const barejid)
+ui_smp_aborted(ProfChatWin *chatwin)
 {
-    ProfChatWin *chatwin = wins_get_chat(barejid);
-    if (chatwin) {
-        win_print((ProfWin*)chatwin, '!', 0, NULL, 0, 0, "", "SMP session aborted.");
-    }
+    assert(chatwin != NULL);
+
+    win_print((ProfWin*)chatwin, '!', 0, NULL, 0, 0, "", "SMP session aborted.");
 }
 
 void
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 140d3426..11b0f9c6 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -72,7 +72,7 @@ void ui_smp_recipient_initiated_q(ProfChatWin *chatwin, const char *question);
 void ui_smp_successful(const char *const barejid);
 void ui_smp_unsuccessful_sender(ProfChatWin *chatwin);
 void ui_smp_unsuccessful_receiver(ProfChatWin *chatwin);
-void ui_smp_aborted(const char *const barejid);
+void ui_smp_aborted(ProfChatWin *chatwin);
 
 void ui_smp_answer_success(const char *const barejid);
 void ui_smp_answer_failure(const char *const barejid);
diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c
index 719b51e9..f2b7b01e 100644
--- a/tests/unittests/ui/stub_ui.c
+++ b/tests/unittests/ui/stub_ui.c
@@ -76,7 +76,7 @@ void ui_smp_recipient_initiated_q(ProfChatWin *chatwin, const char *question) {}
 void ui_smp_successful(const char * const barejid) {}
 void ui_smp_unsuccessful_sender(ProfChatWin *chatwin) {}
 void ui_smp_unsuccessful_receiver(ProfChatWin *chatwin) {}
-void ui_smp_aborted(const char * const barejid) {}
+void ui_smp_aborted(ProfChatWin *chatwin) {}
 
 void ui_smp_answer_success(const char * const barejid) {}
 void ui_smp_answer_failure(const char * const barejid) {}