From 5c5ed64180a6b76315ee7b8c6000ee64ad5877a7 Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Thu, 25 Jan 2018 15:33:24 +0100 Subject: try to make sure the server is still good enough to call ischannel when printing netsplit/join --- src/fe-common/irc/fe-netjoin.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/fe-common/irc/fe-netjoin.c') diff --git a/src/fe-common/irc/fe-netjoin.c b/src/fe-common/irc/fe-netjoin.c index a7a2e4fe..9ea633b4 100644 --- a/src/fe-common/irc/fe-netjoin.c +++ b/src/fe-common/irc/fe-netjoin.c @@ -245,17 +245,24 @@ static void print_netjoins(NETJOIN_SERVER_REC *server, const char *filter_channe message before it. */ static void sig_print_starting(TEXT_DEST_REC *dest) { - GSList *tmp, *next; + NETJOIN_SERVER_REC *rec; if (printing_joins) return; - for (tmp = joinservers; tmp != NULL; tmp = next) { - NETJOIN_SERVER_REC *server = tmp->data; + if (!IS_IRC_SERVER(dest->server)) + return; - next = tmp->next; - if (server->netjoins != NULL) - print_netjoins(server, NULL); + rec = netjoin_find_server(IRC_SERVER(dest->server)); + if (rec != NULL && rec->netjoins != NULL) { + /* if netjoins exists, the server rec should be + still valid. otherwise, calling server->ischannel + may not be safe. */ + if (dest->target != NULL && + !server_ischannel((SERVER_REC *) rec->server, dest->target)) + return; + + print_netjoins(rec, NULL); } } -- cgit v1.2.3