Handle SDL_INIT_VIDEO failing, so we don't crash later.
This commit is contained in:
@@ -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
|
* as possible, because if we have to shut it down again we'll flash a window
|
||||||
* briefly. */
|
* briefly. */
|
||||||
if(!SDL_WasInit(SDL_INIT_VIDEO))
|
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.
|
/* 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
|
* 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 );
|
EventEnabled[i] = mySDL_EventState( (Uint8) i, SDL_QUERY );
|
||||||
|
|
||||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
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. */
|
/* Put them back. */
|
||||||
for( i = 0; i < SDL_NUMEVENTS; ++i)
|
for( i = 0; i < SDL_NUMEVENTS; ++i)
|
||||||
|
|||||||
Reference in New Issue
Block a user