From 09e20e1d78c91ce7ba72720ef13a24e1b8bb1bfe Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 15 Jun 2000 18:33:08 +0000 Subject: [PATCH] "window changed" signal handler didn't check if the old or new window is NULL. window_has_query() git-svn-id: http://svn.irssi.org/repos/irssi/trunk@351 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-common/irc/fe-query.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fe-common/irc/fe-query.c b/src/fe-common/irc/fe-query.c index 4413be38..d93ae114 100644 --- a/src/fe-common/irc/fe-query.c +++ b/src/fe-common/irc/fe-query.c @@ -131,6 +131,8 @@ static int window_has_query(WINDOW_REC *window) { GSList *tmp; + g_return_val_if_fail(window != NULL, FALSE); + for (tmp = window->items; tmp != NULL; tmp = tmp->next) { if (irc_item_query(tmp->data)) return TRUE; @@ -147,9 +149,9 @@ static void sig_window_changed(WINDOW_REC *window, WINDOW_REC *old_window) /* reset the window's last_line timestamp so that query doesn't get closed immediately after switched to the window, or after changed to some other window from it */ - if (window_has_query(window)) + if (window != NULL && window_has_query(window)) window->last_line = time(NULL); - if (window_has_query(old_window)) + if (old_window != NULL && window_has_query(old_window)) old_window->last_line = time(NULL); }