From: H.G. Muller Date: Fri, 10 Feb 2012 16:35:22 +0000 (+0100) Subject: Fix crash on empty combobox menu XB X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=6ff6104ef891b0a81b442f3228c1f4278d23e3e9;p=xboard.git Fix crash on empty combobox menu XB XBoard crashed when a combobox without items was opened, as could easily happen in the Load Engine dialogs when -firstChessProgramNames contained no items, as it would without configuring. Now the creation of the popup menu is suppressed in that case. --- diff --git a/xoptions.c b/xoptions.c index 446cf15..22aac1e 100644 --- a/xoptions.c +++ b/xoptions.c @@ -220,13 +220,13 @@ CreateComboPopup (Widget parent, Option *option, int n) int i=0, j; Widget menu, entry; Arg args[16]; + char **mb = (char **) option->textValue; + if(mb[0] == NULL) return; // avoid empty menus, as they cause crash menu = XtCreatePopupShell(option->name, simpleMenuWidgetClass, parent, NULL, 0); j = 0; XtSetArg(args[j], XtNwidth, 100); j++; -// XtSetArg(args[j], XtNright, XtChainRight); j++; - char **mb = (char **) option->textValue; while (mb[i] != NULL) { if (option->min & NO_GETTEXT)