mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user