diff --git a/src/common/StringMap.h b/src/common/StringMap.h index 116a45658..34ad7eee8 100644 --- a/src/common/StringMap.h +++ b/src/common/StringMap.h @@ -126,7 +126,7 @@ public: if (index >= SIZE) { - printf("\nConstant %s out of bounds with %i!\n", key, index); + printf("Constant %s out of bounds with %u!\n", key, index); return false; } diff --git a/src/common/runtime.cpp b/src/common/runtime.cpp index e4da8991a..720090176 100644 --- a/src/common/runtime.cpp +++ b/src/common/runtime.cpp @@ -538,7 +538,7 @@ int luax_insist(lua_State *L, int idx, const char *k) { // Convert to absolute index if necessary. if (idx < 0 && idx > LUA_REGISTRYINDEX) - idx = lua_gettop(L) + ++idx; + idx += lua_gettop(L) + 1; lua_getfield(L, idx, k); diff --git a/src/modules/graphics/opengl/wrap_Mesh.cpp b/src/modules/graphics/opengl/wrap_Mesh.cpp index c70d7970d..e075d0179 100644 --- a/src/modules/graphics/opengl/wrap_Mesh.cpp +++ b/src/modules/graphics/opengl/wrap_Mesh.cpp @@ -147,6 +147,9 @@ int w_Mesh_getVertices(lua_State *L) size_t count = t->getVertexCount(); lua_createtable(L, count, 0); + if (count == 0 || vertices == nullptr) + return 1; + for (size_t i = 0; i < count; i++) { // Create vertex table.