Handle SDL_INIT_VIDEO failing, so we don't crash later.

This commit is contained in:
Glenn Maynard
2003-06-11 03:17:39 +00:00
parent 5faa1d7c17
commit 3d43798f88
2 changed files with 6 additions and 2 deletions
+4 -1
View File
@@ -235,7 +235,10 @@ RageDisplay_D3D::RageDisplay_D3D( VideoModeParams p )
* as possible, because if we have to shut it down again we'll flash a window
* briefly. */
if(!SDL_WasInit(SDL_INIT_VIDEO))
SDL_InitSubSystem(SDL_INIT_VIDEO);
{
if( SDL_InitSubSystem(SDL_INIT_VIDEO) == -1 )
RageException::Throw( "SDL_INIT_VIDEO failed: %s", SDL_GetError() );
}
/* By default, ignore all SDL events. We'll enable them as we need them.
* We must not enable any events we don't actually want, since we won't
@@ -64,7 +64,8 @@ bool LowLevelWindow_SDL::TryVideoMode( RageDisplay::VideoModeParams p, bool &bNe
EventEnabled[i] = mySDL_EventState( (Uint8) i, SDL_QUERY );
SDL_QuitSubSystem(SDL_INIT_VIDEO);
SDL_InitSubSystem(SDL_INIT_VIDEO);
if( SDL_InitSubSystem(SDL_INIT_VIDEO) == -1 )
RageException::Throw( "SDL_INIT_VIDEO failed: %s", SDL_GetError() );
/* Put them back. */
for( i = 0; i < SDL_NUMEVENTS; ++i)