Browse Source

Fixed World:getBodyList, World:getJointList, and World:getContactList causing hard crashes instead of Lua errors

Alex Szpakowski 11 years ago
parent
commit
c17cada9e0
1 changed files with 9 additions and 3 deletions
  1. 9 3
      src/modules/physics/box2d/wrap_World.cpp

+ 9 - 3
src/modules/physics/box2d/wrap_World.cpp

@@ -143,21 +143,27 @@ int w_World_getBodyList(lua_State *L)
 {
 {
 	World *t = luax_checkworld(L, 1);
 	World *t = luax_checkworld(L, 1);
 	lua_remove(L, 1);
 	lua_remove(L, 1);
-	return t->getBodyList(L);
+	int ret = 0;
+	EXCEPT_GUARD(ret = t->getBodyList(L);)
+	return ret;
 }
 }
 
 
 int w_World_getJointList(lua_State *L)
 int w_World_getJointList(lua_State *L)
 {
 {
 	World *t = luax_checkworld(L, 1);
 	World *t = luax_checkworld(L, 1);
 	lua_remove(L, 1);
 	lua_remove(L, 1);
-	return t->getJointList(L);
+	int ret = 0;
+	EXCEPT_GUARD(ret = t->getJointList(L);)
+	return ret;
 }
 }
 
 
 int w_World_getContactList(lua_State *L)
 int w_World_getContactList(lua_State *L)
 {
 {
 	World *t = luax_checkworld(L, 1);
 	World *t = luax_checkworld(L, 1);
 	lua_remove(L, 1);
 	lua_remove(L, 1);
-	return t->getContactList(L);
+	int ret = 0;
+	EXCEPT_GUARD(ret = t->getContactList(L);)
+	return ret;
 }
 }
 
 
 int w_World_queryBoundingBox(lua_State *L)
 int w_World_queryBoundingBox(lua_State *L)