Fixed crash when vid_setmode CCMD is used from command line

It's impossible to validate video mode at such early stage of initialization
Added sanity check for mode's width and height as well

https://forum.zdoom.org/viewtopic.php?t=59990
This commit is contained in:
alexey.lysiuk 2018-04-04 11:46:14 +03:00
parent d3cacbf246
commit 2e7d196f8b
1 changed files with 2 additions and 8 deletions

View File

@ -1454,7 +1454,6 @@ bool IVideo::SetResolution (int width, int height, int bits)
CCMD (vid_setmode)
{
bool goodmode = false;
int width = 0, height = SCREENHEIGHT;
int bits = DisplayBits;
@ -1471,13 +1470,8 @@ CCMD (vid_setmode)
}
}
if (width && I_CheckResolution (width, height, bits))
{
goodmode = true;
}
if (!fullscreen)
goodmode = true;
const bool goodmode = (width > 0 && height > 0)
&& (!fullscreen || (Video != nullptr && I_CheckResolution(width, height, bits)));
if (goodmode)
{