From c17cada9e071144e21a081827735ddefec053534 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Mon, 10 Feb 2014 14:01:59 -0400 Subject: [PATCH] Fixed World:getBodyList, World:getJointList, and World:getContactList causing hard crashes instead of Lua errors --- src/modules/physics/box2d/wrap_World.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/modules/physics/box2d/wrap_World.cpp b/src/modules/physics/box2d/wrap_World.cpp index b4739f24c..fb45ead88 100644 --- a/src/modules/physics/box2d/wrap_World.cpp +++ b/src/modules/physics/box2d/wrap_World.cpp @@ -143,21 +143,27 @@ int w_World_getBodyList(lua_State *L) { World *t = luax_checkworld(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) { World *t = luax_checkworld(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) { World *t = luax_checkworld(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)