1
0
mirror of https://github.com/irssi/irssi.git synced 2024-11-03 04:27:19 -05:00

Merge pull request #832 from ailin-nemui/netsplit-crash

try to make sure the server is still good enough to call ischannel when printing netsplit/join
This commit is contained in:
ailin-nemui 2018-02-12 10:54:42 +01:00 committed by GitHub
commit ccfb2dabcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 11 deletions

View File

@ -245,17 +245,24 @@ static void print_netjoins(NETJOIN_SERVER_REC *server, const char *filter_channe
message before it. */ message before it. */
static void sig_print_starting(TEXT_DEST_REC *dest) static void sig_print_starting(TEXT_DEST_REC *dest)
{ {
GSList *tmp, *next; NETJOIN_SERVER_REC *rec;
if (printing_joins) if (printing_joins)
return; return;
for (tmp = joinservers; tmp != NULL; tmp = next) { if (!IS_IRC_SERVER(dest->server))
NETJOIN_SERVER_REC *server = tmp->data; return;
next = tmp->next; rec = netjoin_find_server(IRC_SERVER(dest->server));
if (server->netjoins != NULL) if (rec != NULL && rec->netjoins != NULL) {
print_netjoins(server, 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);
} }
} }

View File

@ -247,15 +247,22 @@ static int check_server_splits(IRC_SERVER_REC *server)
message before it. */ message before it. */
static void sig_print_starting(TEXT_DEST_REC *dest) static void sig_print_starting(TEXT_DEST_REC *dest)
{ {
GSList *tmp; IRC_SERVER_REC *rec;
if (printing_splits) if (printing_splits)
return; return;
for (tmp = servers; tmp != NULL; tmp = tmp->next) { if (!IS_IRC_SERVER(dest->server))
IRC_SERVER_REC *rec = tmp->data; return;
rec = IRC_SERVER(dest->server);
if (rec->split_servers != NULL) {
/* if split_servers 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, dest->target))
return;
if (IS_IRC_SERVER(rec) && rec->split_servers != NULL)
print_splits(rec, NULL); print_splits(rec, NULL);
} }
} }