Invalid "Desktop" values would crash winecfg, use the default value
instead.
This commit is contained in:
parent
35ac185de7
commit
bcaac8e158
|
@ -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)
|
||||||
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);
|
||||||
|
|
Loading…
Reference in New Issue