From d0d087511ff321868cccc79797d52763c4dc2d2b Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Tue, 10 Dec 2019 23:41:40 +0000 Subject: [PATCH] MSVC: Fix SDL binary assertion failure on start. sdlReadDesktopVideoMode() was apparently being called when the window pointer is NULL. Wrap the code in an `if (window) { ... }`. SDL binary now launches correctly. Signed-off-by: Rafael Kitover --- src/sdl/SDL.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/sdl/SDL.cpp b/src/sdl/SDL.cpp index 469afe2d..2ec53664 100644 --- a/src/sdl/SDL.cpp +++ b/src/sdl/SDL.cpp @@ -763,10 +763,12 @@ void sdlReadBattery() void sdlReadDesktopVideoMode() { - SDL_DisplayMode dm; - SDL_GetDesktopDisplayMode(SDL_GetWindowDisplayIndex(window), &dm); - desktopWidth = dm.w; - desktopHeight = dm.h; + if (window) { + SDL_DisplayMode dm; + SDL_GetDesktopDisplayMode(SDL_GetWindowDisplayIndex(window), &dm); + desktopWidth = dm.w; + desktopHeight = dm.h; + } } static void sdlResizeVideo()