From eb2989176e00b8cdfd2011dc0d39e863a6e23cbe Mon Sep 17 00:00:00 2001 From: olsner Date: Tue, 21 Sep 2004 16:10:46 +0000 Subject: [PATCH] startGame() shouldn't crash and burn if the game's already been started This was SVN commit r1181. --- source/scripting/ScriptGlue.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/scripting/ScriptGlue.cpp b/source/scripting/ScriptGlue.cpp index f0efaf2173..ddc9333ca6 100755 --- a/source/scripting/ScriptGlue.cpp +++ b/source/scripting/ScriptGlue.cpp @@ -350,9 +350,12 @@ JSBool startGame(JSContext* cx, JSObject* UNUSEDPARAM(globalObject), unsigned in } if (g_NetServer) g_NetServer->StartGame(); - else if (g_NetClient) // startGame is invalid on joined games; do nothing and return an error - return JS_FALSE; - else + else if (g_NetClient) // startGame is invalid on joined games; do nothing and return false + { + *rval=BOOLEAN_TO_JSVAL(JS_FALSE); + return JS_TRUE; + } + else if (!g_Game) { g_Game=new CGame(); g_Game->StartGame(&g_GameAttributes);