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

View file

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