diff --git a/src/modules/graphics/opengl/wrap_Graphics.cpp b/src/modules/graphics/opengl/wrap_Graphics.cpp index 90202a941..44506307f 100644 --- a/src/modules/graphics/opengl/wrap_Graphics.cpp +++ b/src/modules/graphics/opengl/wrap_Graphics.cpp @@ -400,7 +400,8 @@ int w_newCanvas(lua_State *L) const char *str = luaL_optstring(L, 3, "normal"); Canvas::TextureType texture_type; - Canvas::getConstant(str, texture_type); + if (!Canvas::getConstant(str, texture_type)) + return luaL_error(L, "Invalid canvas type: %s", str); Canvas *canvas = NULL; try