From 4e167072ae558e114cacec28ad5abb2ec2cdf05c Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Wed, 26 Aug 2026 00:47:02 -0300 Subject: [PATCH] love.graphics.newBuffer: fix potential hard-crash when format table is empty --- src/modules/graphics/wrap_Graphics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/graphics/wrap_Graphics.cpp b/src/modules/graphics/wrap_Graphics.cpp index 8221cc9e3..4937b1d97 100644 --- a/src/modules/graphics/wrap_Graphics.cpp +++ b/src/modules/graphics/wrap_Graphics.cpp @@ -1870,7 +1870,7 @@ static Buffer *luax_newbuffer(lua_State *L, int idx, Buffer::Settings settings, tableoftables = lua_istable(L, -1); lua_pop(L, 1); - if (!tableoftables) + if (!tableoftables && 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);