Browse Source

Catch exceptions thrown while encoding image data (issue #282)

Bart van Strien 14 years ago
parent
commit
ceab3f7a44
1 changed files with 8 additions and 1 deletions
  1. 8 1
      src/modules/image/wrap_ImageData.cpp

+ 8 - 1
src/modules/image/wrap_ImageData.cpp

@@ -157,7 +157,14 @@ namespace image
 		}
 		ImageData::Format format;
 		ImageData::getConstant(fmt, format);
-		t->encode(file, format);
+		try
+		{
+			t->encode(file, format);
+		}
+		catch (love::Exception & e)
+		{
+			return luaL_error(L, e.what());
+		}
 		return 0;
 	}