Catch very early fatal warning from SDL when it can't even initialize itself.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3094 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2014-11-20 14:20:03 +00:00
parent c8400dcfe6
commit fb4332a0c7
2 changed files with 7 additions and 4 deletions

View File

@ -47,7 +47,7 @@ FrameBufferSDL2::FrameBufferSDL2(OSystem& osystem)
ostringstream buf;
buf << "ERROR: Couldn't initialize SDL: " << SDL_GetError() << endl;
myOSystem.logMessage(buf.str(), 0);
return;
throw "FATAL ERROR";
}
myOSystem.logMessage("FrameBufferSDL2::FrameBufferSDL2 SDL_Init()", 2);

View File

@ -120,7 +120,8 @@ bool OSystem::create()
// Get relevant information about the video hardware
// This must be done before any graphics context is created, since
// it may be needed to initialize the size of graphical objects
myFrameBuffer = MediaFactory::createVideo(*this);
try { myFrameBuffer = MediaFactory::createVideo(*this); }
catch(...) { return false; }
if(!myFrameBuffer->initialize())
return false;
@ -174,9 +175,11 @@ void OSystem::loadConfig()
void OSystem::saveConfig()
{
// Ask all subsystems to save their settings
myFrameBuffer->tiaSurface().ntsc().saveConfig(*mySettings);
if(myFrameBuffer)
myFrameBuffer->tiaSurface().ntsc().saveConfig(*mySettings);
mySettings->saveConfig();
if(mySettings)
mySettings->saveConfig();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -