Use proper detection of error/failure from GetSystemMetrics() API calls in win32/vid_dll.c->VID_GetModeInfo().

This commit is contained in:
Knightmare66 2021-11-01 20:38:22 -04:00
parent 95295401a4
commit d552aa1e48

View file

@ -562,10 +562,16 @@ qboolean VID_GetModeInfo (int *width, int *height, int mode)
// desktop-resolution display mode
if ( r_mode_desktop->integer && (vid_fullscreen->integer >= 2) )
{
*width = GetSystemMetrics(SM_CXVIRTUALSCREEN);
*height = GetSystemMetrics(SM_CYVIRTUALSCREEN);
if ( (width == 0) || (height == 0) )
int dskWidth=0, dskHeight=0;
dskWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
dskHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
// Check for API call failure
if ( (dskWidth == 0) || (dskHeight == 0) )
return false;
*width = dskWidth;
*height = dskHeight;
return true;
}