From 1cb6ab9db189e36fbe006a9969c9e784dcb90906 Mon Sep 17 00:00:00 2001 From: terminx Date: Thu, 12 Apr 2018 21:04:07 +0000 Subject: [PATCH] Prevent divide by 0 when SDL_GetCurrentDisplayMode()/SDL_GetClosestDisplayMode() say the refresh rate is 0 git-svn-id: https://svn.eduke32.com/eduke32@6833 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/src/sdlayer.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/build/src/sdlayer.cpp b/source/build/src/sdlayer.cpp index 4296be583..3eb023bc3 100644 --- a/source/build/src/sdlayer.cpp +++ b/source/build/src/sdlayer.cpp @@ -1519,6 +1519,9 @@ void setrefreshrate(void) SDL_SetWindowDisplayMode(sdl_window, &newmode); } + if (!newmode.refresh_rate) + newmode.refresh_rate = 60; + currentVBlankInterval = 1000/newmode.refresh_rate; }