Commit bcaac8e1 authored by Chris Morgan's avatar Chris Morgan Committed by Alexandre Julliard

Invalid "Desktop" values would crash winecfg, use the default value

instead.
parent 35ac185d
...@@ -86,6 +86,7 @@ void updateGUIForDesktopMode(HWND dialog) { ...@@ -86,6 +86,7 @@ void updateGUIForDesktopMode(HWND dialog) {
/* pokes the win32 api to setup the dialog from the config struct */ /* pokes the win32 api to setup the dialog from the config struct */
void initX11DrvDlg (HWND hDlg) void initX11DrvDlg (HWND hDlg)
{ {
static const char default_desktop[] = "640x480";
char *buf; char *buf;
char *bufindex; char *bufindex;
...@@ -94,8 +95,14 @@ void initX11DrvDlg (HWND hDlg) ...@@ -94,8 +95,14 @@ void initX11DrvDlg (HWND hDlg)
updatingUI = TRUE; updatingUI = TRUE;
/* desktop size */ /* desktop size */
buf = getConfigValue(section, "Desktop", "640x480"); buf = getConfigValue(section, "Desktop", default_desktop);
bufindex = strchr(buf, 'x'); bufindex = strchr(buf, 'x');
if(!bufindex) /* handle invalid "Desktop" values */
{
free(buf);
buf = strdup(default_desktop);
bufindex = strchr(buf, 'x');
}
*bufindex = '\0'; *bufindex = '\0';
bufindex++; bufindex++;
SetWindowText(GetDlgItem(hDlg, IDC_DESKTOP_WIDTH), buf); SetWindowText(GetDlgItem(hDlg, IDC_DESKTOP_WIDTH), buf);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment