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

instead.
This commit is contained in:
Chris Morgan 2004-03-30 04:34:40 +00:00 committed by Alexandre Julliard
parent 35ac185de7
commit bcaac8e158
1 changed files with 8 additions and 1 deletions

View File

@ -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);