From bcaac8e158b637dbb480cee06a0074ba67d90bb8 Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Tue, 30 Mar 2004 04:34:40 +0000 Subject: [PATCH] Invalid "Desktop" values would crash winecfg, use the default value instead. --- programs/winecfg/x11drvdlg.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/programs/winecfg/x11drvdlg.c b/programs/winecfg/x11drvdlg.c index afa14471699..4a67112df0b 100644 --- a/programs/winecfg/x11drvdlg.c +++ b/programs/winecfg/x11drvdlg.c @@ -86,6 +86,7 @@ void updateGUIForDesktopMode(HWND dialog) { /* pokes the win32 api to setup the dialog from the config struct */ void initX11DrvDlg (HWND hDlg) { + static const char default_desktop[] = "640x480"; char *buf; char *bufindex; @@ -94,8 +95,14 @@ void initX11DrvDlg (HWND hDlg) updatingUI = TRUE; /* desktop size */ - buf = getConfigValue(section, "Desktop", "640x480"); + buf = getConfigValue(section, "Desktop", default_desktop); bufindex = strchr(buf, 'x'); + if(!bufindex) /* handle invalid "Desktop" values */ + { + free(buf); + buf = strdup(default_desktop); + bufindex = strchr(buf, 'x'); + } *bufindex = '\0'; bufindex++; SetWindowText(GetDlgItem(hDlg, IDC_DESKTOP_WIDTH), buf); -- 2.11.4.GIT