From 5618f4890df5eb9ea91eb73a7a7dd7df745863a6 Mon Sep 17 00:00:00 2001 From: Guillaume Melquiond Date: Sun, 23 Sep 2007 12:55:09 +0000 Subject: Robustified code with respect to insertion failures. --- src/scripting/lua.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/scripting') diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp index f33393a..048bc6f 100644 --- a/src/scripting/lua.cpp +++ b/src/scripting/lua.cpp @@ -178,7 +178,10 @@ static int LuaNpc_Create(lua_State *s) } q->setMap(m); q->setPosition(Point(lua_tointeger(s, 2), lua_tointeger(s, 3))); - GameState::insert(q); + bool b = GameState::insert(q); + /* Do not try to deal with a failure there. There are some serious issues + if an insertion failed on an almost empty map. */ + assert(b); (void)b; lua_pushlightuserdata(s, q); return 1; } -- cgit