Procházet zdrojové kódy

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

Bart van Strien před 14 roky
rodič
revize
ceab3f7a44
1 změnil soubory, kde provedl 8 přidání a 1 odebrání
  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;
 	}