From f05e681b24228adc80dce47363e86aca54aac05a Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sun, 21 Apr 2013 18:49:56 -0700 Subject: [PATCH] Error instead of crash when love.graphics.newGeometry fails --- src/modules/graphics/opengl/wrap_Graphics.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/modules/graphics/opengl/wrap_Graphics.cpp b/src/modules/graphics/opengl/wrap_Graphics.cpp index 4f2676a98..1ee9c9b5d 100644 --- a/src/modules/graphics/opengl/wrap_Graphics.cpp +++ b/src/modules/graphics/opengl/wrap_Graphics.cpp @@ -418,7 +418,15 @@ int w_newGeometry(lua_State *L) vertices.push_back(v); } - Geometry *geom = instance->newGeometry(vertices); + Geometry *geom = 0; + try + { + geom = instance->newGeometry(vertices); + } + catch (love::Exception &e) + { + return luaL_error(L, "%s", e.what()); + } if (geom == 0) return luaL_error(L, "Could not create geometry.");