mirror of
https://github.com/love2d/love.git
synced 2026-08-28 18:26:55 +02:00
love.graphics.newBuffer: fix potential hard-crash when format table is empty
This commit is contained in:
@@ -1870,7 +1870,7 @@ static Buffer *luax_newbuffer(lua_State *L, int idx, Buffer::Settings settings,
|
|||||||
tableoftables = lua_istable(L, -1);
|
tableoftables = lua_istable(L, -1);
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|
||||||
if (!tableoftables)
|
if (!tableoftables && ncomponents > 0)
|
||||||
{
|
{
|
||||||
if (arraylength % ncomponents != 0)
|
if (arraylength % ncomponents != 0)
|
||||||
luaL_error(L, "Array length in flat array variant of newBuffer must be a multiple of the total number of components (%d)", ncomponents);
|
luaL_error(L, "Array length in flat array variant of newBuffer must be a multiple of the total number of components (%d)", ncomponents);
|
||||||
|
|||||||
Reference in New Issue
Block a user