Browse Source

Catch possible exceptions thrown when locking a SpriteBatch twice

Bart van Strien 12 years ago
parent
commit
94516e2290
1 changed files with 8 additions and 1 deletions
  1. 8 1
      src/modules/graphics/opengl/wrap_SpriteBatch.cpp

+ 8 - 1
src/modules/graphics/opengl/wrap_SpriteBatch.cpp

@@ -112,7 +112,14 @@ int w_SpriteBatch_clear(lua_State *L)
 int w_SpriteBatch_bind(lua_State *L)
 {
 	SpriteBatch *t = luax_checkspritebatch(L, 1);
-	t->lock();
+	try
+	{
+		t->lock();
+	}
+	catch (love::Exception &e)
+	{
+		return luaL_error(L, "%s", e.what());
+	}
 	return 0;
 }