From ceab3f7a443b6d78ee151cace53de7583274c255 Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Mon, 22 Aug 2011 18:07:50 +0200 Subject: [PATCH] Catch exceptions thrown while encoding image data (issue #282) --- src/modules/image/wrap_ImageData.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/modules/image/wrap_ImageData.cpp b/src/modules/image/wrap_ImageData.cpp index ccd7f5439..eabf5b00e 100644 --- a/src/modules/image/wrap_ImageData.cpp +++ b/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; }