diff src/video/x11/SDL_x11modes.c @ 3521:76f9b76ddf0f

Don't add any renderers if you can't add any displays
author Sam Lantinga <slouken@libsdl.org>
date Fri, 04 Dec 2009 09:01:48 +0000
parents 4b594623401b
children f7b03b6838cb
line wrap: on
line diff
--- a/src/video/x11/SDL_x11modes.c	Fri Dec 04 08:45:08 2009 +0000
+++ b/src/video/x11/SDL_x11modes.c	Fri Dec 04 09:01:48 2009 +0000
@@ -118,7 +118,7 @@
     return SDL_PIXELFORMAT_UNKNOWN;
 }
 
-void
+int
 X11_InitModes(_THIS)
 {
     SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
@@ -168,6 +168,11 @@
         display.driverdata = displaydata;
         SDL_AddVideoDisplay(&display);
     }
+    if (_this->num_displays == 0) {
+        SDL_SetError("No available displays");
+        return -1;
+    }
+    return 0;
 }
 
 /* Global for the error handler */