Fixed SpriteBatch:addg/setg to error properly instead of crash when attempting to use a Geometry without exactly 4 vertices

This commit is contained in:
Alex Szpakowski
2013-05-20 14:47:37 -03:00
parent 167d3183b9
commit 89265107ea
@@ -63,7 +63,14 @@ int w_SpriteBatch_addg(lua_State *L)
float oy = (float)luaL_optnumber(L, 9, 0);
float kx = (float)luaL_optnumber(L, 10, 0);
float ky = (float)luaL_optnumber(L, 11, 0);
lua_pushnumber(L, t->addg(g, x, y, angle, sx, sy, ox, oy, kx, ky));
try
{
lua_pushnumber(L, t->addg(g, x, y, angle, sx, sy, ox, oy, kx, ky));
}
catch (love::Exception &e)
{
return luaL_error(L, "%s", e.what());
}
return 1;
}
@@ -99,7 +106,14 @@ int w_SpriteBatch_setg(lua_State *L)
float oy = (float)luaL_optnumber(L, 10, 0);
float kx = (float)luaL_optnumber(L, 11, 0);
float ky = (float)luaL_optnumber(L, 12, 0);
t->addg(g, x, y, angle, sx, sy, ox, oy, kx, ky, index);
try
{
t->addg(g, x, y, angle, sx, sy, ox, oy, kx, ky, index);
}
catch (love::Exception &e)
{
return luaL_error(L, "%s", e.what());
}
return 0;
}