From 77f43fe1fba18a8a627d5e565e53fa619f454277 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 10 Dec 2003 23:04:00 +0000 Subject: [PATCH] Window layout restoring queries didn't check if the chat protocol was yet loaded and crashed. Patch by c0ffee git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3194 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-common/core/windows-layout.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/fe-common/core/windows-layout.c b/src/fe-common/core/windows-layout.c index 9429c00a..223b6524 100644 --- a/src/fe-common/core/windows-layout.c +++ b/src/fe-common/core/windows-layout.c @@ -61,12 +61,25 @@ static void sig_layout_restore_item(WINDOW_REC *window, const char *type, WINDOW_BIND_REC *rec = window_bind_add(window, tag, name); rec->sticky = TRUE; } else if (g_strcasecmp(type, "QUERY") == 0 && chat_type != NULL) { + CHAT_PROTOCOL_REC *protocol; /* create query immediately */ signal_add("query created", (SIGNAL_FUNC) signal_query_created_curwin); restore_win = window; - chat_protocol_find(chat_type)->query_create(tag, name, TRUE); + + protocol = chat_protocol_find(chat_type); + if (protocol->query_create != NULL) + protocol->query_create(tag, name, TRUE); + else { + QUERY_REC *query; + + query = g_new0(QUERY_REC, 1); + query->chat_type = chat_protocol_lookup(chat_type); + query->name = g_strdup(name); + query->server_tag = g_strdup(tag); + query_init(query, TRUE); + } signal_remove("query created", (SIGNAL_FUNC) signal_query_created_curwin);