From 830283ff17b460c092b76304f53aeb63016cae36 Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Sat, 3 Mar 2012 12:35:55 +0100 Subject: [PATCH] Properly catch exceptions thrown by ImageData:getPixel/setPixel, thereby preventing an uncaught exception for an invalid index. (Bug #381) --- src/modules/image/wrap_ImageData.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/image/wrap_ImageData.cpp b/src/modules/image/wrap_ImageData.cpp index 99c4c4095..3e7c063c1 100644 --- a/src/modules/image/wrap_ImageData.cpp +++ b/src/modules/image/wrap_ImageData.cpp @@ -56,9 +56,9 @@ namespace image { c = t->getPixel(x, y); } - catch (love::Exception *e) + catch (love::Exception & e) { - return luaL_error(L, "%s", e->what()); + return luaL_error(L, "%s", e.what()); } lua_pushnumber(L, c.r); lua_pushnumber(L, c.g); @@ -81,9 +81,9 @@ namespace image { t->setPixel(x, y, c); } - catch (love::Exception *e) + catch (love::Exception & e) { - return luaL_error(L, "%s", e->what()); + return luaL_error(L, "%s", e.what()); } return 0; }