Fixed undefined behaviour when love exceptions are converted into Lua errors (resolves issue #729)

This commit is contained in:
Alex Szpakowski
2013-09-05 23:17:29 -03:00
parent 389e99bf2c
commit 06f80d5c08
45 changed files with 349 additions and 873 deletions
+5 -10
View File
@@ -65,7 +65,7 @@ int w_Fixture_setDensity(lua_State *L)
{
Fixture *t = luax_checkfixture(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
ASSERT_GUARD(t->setDensity(arg1);)
EXCEPT_GUARD(t->setDensity(arg1);)
return 0;
}
@@ -156,7 +156,9 @@ int w_Fixture_rayCast(lua_State *L)
{
Fixture *t = luax_checkfixture(L, 1);
lua_remove(L, 1);
ASSERT_GUARD(return t->rayCast(L);)
int ret = 0;
EXCEPT_GUARD(ret = t->rayCast(L);)
return ret;
}
int w_Fixture_setFilterData(lua_State *L)
@@ -256,14 +258,7 @@ int w_Fixture_setGroupIndex(lua_State *L)
int w_Fixture_destroy(lua_State *L)
{
Fixture *t = luax_checkfixture(L, 1);
try
{
t->destroy();
}
catch(love::Exception &e)
{
luaL_error(L, "%s", e.what());
}
EXCEPT_GUARD(t->destroy();)
return 0;
}