Mercurial > sdl-ios-xcode
diff src/video/win32/SDL_win32modes.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 | 59ff7a2beb57 |
line wrap: on
line diff
--- a/src/video/win32/SDL_win32modes.c Fri Dec 04 08:45:08 2009 +0000 +++ b/src/video/win32/SDL_win32modes.c Fri Dec 04 09:01:48 2009 +0000 @@ -157,7 +157,7 @@ return SDL_TRUE; } -void +int WIN_InitModes(_THIS) { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; @@ -192,6 +192,11 @@ WIN_AddDisplay(DeviceName); } } + if (_this->num_displays == 0) { + SDL_SetError("No displays available"); + return -1; + } + return 0; } void @@ -205,10 +210,11 @@ if (!WIN_GetDisplayMode(data->DeviceName, i, &mode)) { break; } - if (mode.format != SDL_PIXELFORMAT_UNKNOWN) + if (mode.format != SDL_PIXELFORMAT_UNKNOWN) { if (!SDL_AddDisplayMode(display, &mode)) { SDL_free(mode.driverdata); } + } } }