mirror of
https://github.com/love2d/love.git
synced 2026-08-21 13:09:56 +02:00
Error instead of crash when love.graphics.newGeometry fails
This commit is contained in:
@@ -418,7 +418,15 @@ int w_newGeometry(lua_State *L)
|
|||||||
vertices.push_back(v);
|
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)
|
if (geom == 0)
|
||||||
return luaL_error(L, "Could not create geometry.");
|
return luaL_error(L, "Could not create geometry.");
|
||||||
|
|||||||
Reference in New Issue
Block a user