From: H.G.Muller Date: Mon, 3 Aug 2015 19:59:43 +0000 (+0200) Subject: Prevent printing in non-existing Chat dialog (XB) X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=1cf0c44e3d5355d99af00afd84f4d922891d44ef Prevent printing in non-existing Chat dialog (XB) The Xaw build of XBoard crashed in -ics -zp mode when the opponent was kibitzing. According to a stack trace OutputChatMessage() tried to change the color of a non-existent button. Although it was not clear how printing there could be attempted if no chats were defined, the routine now is made a no-op when the Chat dialog does not exist, by an immediate return. --- diff --git a/dialogs.c b/dialogs.c index cb9b298..a5e42c5 100644 --- a/dialogs.c +++ b/dialogs.c @@ -1946,6 +1946,7 @@ OutputChatMessage (int partner, char *mess) char *p = texts[partner]; int len = strlen(mess) + 1; + if(!DialogExists(ChatDlg)) return; if(p) len += strlen(p); texts[partner] = (char*) malloc(len); snprintf(texts[partner], len, "%s%s", p ? p : "", mess);