From 84d672ee42778f4c92f577bfdf89c48d77ce3656 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Fri, 29 Dec 2000 00:11:24 +0000 Subject: [PATCH] If msg comes from unknown channel (like when you just closed some channel window and server sends the last msg to the channel) irssi now prints the msg to active window instead of sending glib warning. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1026 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-common/core/fe-messages.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fe-common/core/fe-messages.c b/src/fe-common/core/fe-messages.c index fa431939..86417c64 100644 --- a/src/fe-common/core/fe-messages.c +++ b/src/fe-common/core/fe-messages.c @@ -123,14 +123,16 @@ static void sig_message_public(SERVER_REC *server, const char *msg, int for_me, print_channel, level; char *color, *freemsg; + /* NOTE: this may return NULL if some channel is just closed with + /WINDOW CLOSE and server still sends the few last messages */ chanrec = channel_find(server, target); - g_return_if_fail(chanrec != NULL); for_me = nick_match_msg(chanrec, msg, server->nick); color = for_me ? NULL : hilight_find_nick(target, nick, address, MSGLEVEL_PUBLIC, msg); - print_channel = !window_item_is_active((WI_ITEM_REC *) chanrec); + print_channel = chanrec == NULL || + !window_item_is_active((WI_ITEM_REC *) chanrec); if (!print_channel && settings_get_bool("print_active_channel") && window_item_window((WI_ITEM_REC *) chanrec)->items->next != NULL) print_channel = TRUE;