diff options
author | Max Horn | 2005-05-05 12:03:40 +0000 |
---|---|---|
committer | Max Horn | 2005-05-05 12:03:40 +0000 |
commit | f5900a917c63e8f870ccfd61a9345fc7b3c83181 (patch) | |
tree | e597d22921507eddf4e49639e43193183923170f /base | |
parent | fecc4d5f8481fcd3f303cd06f0cb25c66f50326b (diff) | |
download | scummvm-rg350-f5900a917c63e8f870ccfd61a9345fc7b3c83181.tar.gz scummvm-rg350-f5900a917c63e8f870ccfd61a9345fc7b3c83181.tar.bz2 scummvm-rg350-f5900a917c63e8f870ccfd61a9345fc7b3c83181.zip |
Handle engine creation failure a bit more graceful
svn-id: r17918
Diffstat (limited to 'base')
-rw-r--r-- | base/main.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/base/main.cpp b/base/main.cpp index 70ce2726bc..bddbbed2c2 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -250,6 +250,17 @@ static bool launcherDialog(GameDetector &detector, OSystem &system) { } static int runGame(GameDetector &detector, OSystem &system) { + // Create the game engine + Engine *engine = detector.createEngine(&system); + if (!engine) { + // TODO: Show an error dialog or so? + //GUI::MessageDialog alert("ScummVM could not find any game in the specified directory!"); + //alert.runModal(); + warning("Failed to instantiate engine for target %s", detector._targetName.c_str()); + return 0; + } + + // Set the window caption to the game name Common::String caption(ConfMan.get("description", detector._targetName)); @@ -261,10 +272,6 @@ static int runGame(GameDetector &detector, OSystem &system) { system.setWindowCaption(caption.c_str()); } - // Create the game engine - Engine *engine = detector.createEngine(&system); - assert(engine); - // Add extrapath (if any) to the directory search list if (ConfMan.hasKey("extrapath")) File::addDefaultDirectory(ConfMan.get("extrapath")); |