From 56808ab51f1c2c2736417aff31b99ca0bbfb47b6 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Sun, 26 Jul 2015 19:46:07 +0200 Subject: [PATCH] SDL_GetWindowDisplayIndex() check2 --- code/sdl/sdl_glimp.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/code/sdl/sdl_glimp.c b/code/sdl/sdl_glimp.c index f9b3e845..76c8cac7 100644 --- a/code/sdl/sdl_glimp.c +++ b/code/sdl/sdl_glimp.c @@ -245,9 +245,15 @@ static int GLimp_SetMode(int mode, qboolean fullscreen, qboolean noborder) // If a window exists, note its display index if( SDL_window != NULL ) + { display = SDL_GetWindowDisplayIndex( SDL_window ); + if( display < 0 ) + { + ri.Printf( PRINT_DEVELOPER, "SDL_GetWindowDisplayIndex() failed: %s\n", SDL_GetError() ); + } + } - if( SDL_GetDesktopDisplayMode( display, &desktopMode ) == 0 ) + if( display >= 0 && SDL_GetDesktopDisplayMode( display, &desktopMode ) == 0 ) { displayAspect = (float)desktopMode.w / (float)desktopMode.h;