Correctly handle SDL_GetCurrentDisplayMode return value

This commit is contained in:
Tamás Bálint Misius 2020-10-11 12:31:52 +02:00
parent f137bad7f8
commit a0a0e6c498
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2

View File

@ -174,18 +174,15 @@ void SDLOpen()
desktopWidth = rect.w; desktopWidth = rect.w;
desktopHeight = rect.h; desktopHeight = rect.h;
} }
}
if (Client::Ref().GetPrefBool("AutoDrawLimit", false)) if (Client::Ref().GetPrefBool("AutoDrawLimit", false))
{ {
SDL_DisplayMode displayMode; SDL_DisplayMode displayMode;
SDL_GetCurrentDisplayMode(displayIndex, &displayMode); if (!SDL_GetCurrentDisplayMode(displayIndex, &displayMode) && displayMode.refresh_rate >= 60)
if(displayMode.refresh_rate >= 60)
{ {
ui::Engine::Ref().SetDrawingFrequencyLimit(displayMode.refresh_rate); ui::Engine::Ref().SetDrawingFrequencyLimit(displayMode.refresh_rate);
} }
} }
}
#ifdef WIN #ifdef WIN
SDL_SysWMinfo SysInfo; SDL_SysWMinfo SysInfo;