diff --git a/src/api/l_graphics.c b/src/api/l_graphics.c index 3e2a1f4d..86500514 100644 --- a/src/api/l_graphics.c +++ b/src/api/l_graphics.c @@ -1413,10 +1413,11 @@ static int l_lovrGraphicsNewMesh(lua_State* L) { lua_pop(L, 1); } } + + lovrBufferFlush(vertexBuffer, 0, count * stride); + lovrBufferUnmap(vertexBuffer); } - lovrBufferFlush(vertexBuffer, 0, count * stride); - lovrBufferUnmap(vertexBuffer); lovrRelease(vertexBuffer, lovrBufferDestroy); luax_pushtype(L, Mesh, mesh);