summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sdl/sdl_glimp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/sdl/sdl_glimp.c b/src/sdl/sdl_glimp.c
index ffda45a0..2141c2bb 100644
--- a/src/sdl/sdl_glimp.c
+++ b/src/sdl/sdl_glimp.c
@@ -135,21 +135,21 @@ static void GLimp_DetectAvailableModes(void)
{
int i, j;
char buf[ MAX_STRING_CHARS ] = { 0 };
- size_t numSDLModes;
+ int numSDLModes;
SDL_Rect *modes;
int numModes = 0;
int display = SDL_GetWindowDisplayIndex( SDL_window );
+ numSDLModes = SDL_GetNumDisplayModes( display );
SDL_DisplayMode windowMode;
- if( SDL_GetWindowDisplayMode( SDL_window, &windowMode ) < 0 )
+ if( SDL_GetWindowDisplayMode( SDL_window, &windowMode ) < 0 || numSDLModes <= 0 )
{
ri.Printf( PRINT_WARNING, "Couldn't get window display mode, no resolutions detected\n" );
return;
}
- numSDLModes = SDL_GetNumDisplayModes( display );
- modes = SDL_calloc( numSDLModes, sizeof( SDL_Rect ) );
+ modes = SDL_calloc( (size_t)numSDLModes, sizeof( SDL_Rect ) );
if ( !modes )
{
ri.Error( ERR_FATAL, "Out of memory" );