Catch possible Box2D exception in Fixture:getBoundingBox() (fixes #1196)

This commit is contained in:
Bart van Strien
2016-08-02 13:07:05 +02:00
parent fc2c79ad5f
commit 0ce44e465d
+2 -1
View File
@@ -284,7 +284,8 @@ int Fixture::rayCast(lua_State *L) const
int Fixture::getBoundingBox(lua_State *L) const
{
int childIndex = (int) luaL_optnumber(L, 1, 1) - 1; // Convert from 1-based index
b2AABB box = fixture->GetAABB(childIndex);
b2AABB box;
luax_catchexcept(L, [&]() { box = fixture->GetAABB(childIndex); });
box = Physics::scaleUp(box);
lua_pushnumber(L, box.lowerBound.x);
lua_pushnumber(L, box.lowerBound.y);