forked from 0ad/0ad
Prevented crash when loading non-existent maps
This was SVN commit r1721.
This commit is contained in:
parent
4c3dea8a14
commit
551bef482a
@ -99,7 +99,14 @@ function startLoadingScreen()
|
||||
|
||||
function loadSession()
|
||||
{
|
||||
startGame();
|
||||
if (! startGame())
|
||||
{
|
||||
// Failed to start the game; go back to the main menu. TODO: display an error message.
|
||||
GUIObjectHide("loading_screen");
|
||||
GUIObjectUnhide("pregame_gui");
|
||||
return;
|
||||
}
|
||||
|
||||
GUIObjectHide("loading_screen");
|
||||
GUIObjectUnhide("session_gui");
|
||||
FlipGUI(GUIType);
|
||||
|
@ -402,8 +402,19 @@ JSBool startGame(JSContext* cx, JSObject* UNUSEDPARAM(globalObject), unsigned in
|
||||
else if (!g_Game)
|
||||
{
|
||||
g_Game=new CGame();
|
||||
g_Game->StartGame(&g_GameAttributes);
|
||||
PSRETURN ret = g_Game->StartGame(&g_GameAttributes);
|
||||
if (ret != PSRETURN_OK)
|
||||
{
|
||||
// Failed to start the game - destroy it, and return false
|
||||
|
||||
delete g_Game;
|
||||
g_Game = NULL;
|
||||
|
||||
*rval=BOOLEAN_TO_JSVAL(JS_FALSE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
*rval=BOOLEAN_TO_JSVAL(JS_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user