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,16 +174,13 @@ void SDLOpen()
desktopWidth = rect.w;
desktopHeight = rect.h;
}
}
if (Client::Ref().GetPrefBool("AutoDrawLimit", false))
{
SDL_DisplayMode displayMode;
SDL_GetCurrentDisplayMode(displayIndex, &displayMode);
if(displayMode.refresh_rate >= 60)
if (Client::Ref().GetPrefBool("AutoDrawLimit", false))
{
ui::Engine::Ref().SetDrawingFrequencyLimit(displayMode.refresh_rate);
SDL_DisplayMode displayMode;
if (!SDL_GetCurrentDisplayMode(displayIndex, &displayMode) && displayMode.refresh_rate >= 60)
{
ui::Engine::Ref().SetDrawingFrequencyLimit(displayMode.refresh_rate);
}
}
}