Fixed a crash when Canvas:newImageData should error.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2015-02-28 16:22:02 -04:00
parent faa4a33fe9
commit 395bb0bea8
2 changed files with 4 additions and 5 deletions
+1 -4
View File
@@ -132,10 +132,7 @@ public:
struct ColorMask
{
bool r;
bool g;
bool b;
bool a;
bool r, g, b, a;
bool operator == (const ColorMask &m) const
{
+3 -1
View File
@@ -71,7 +71,9 @@ int w_Canvas_newImageData(lua_State *L)
int w = luaL_optint(L, 4, canvas->getWidth());
int h = luaL_optint(L, 5, canvas->getHeight());
love::image::ImageData *img = canvas->newImageData(image, x, y, w, h);
love::image::ImageData *img = nullptr;
luax_catchexcept(L, [&](){ img = canvas->newImageData(image, x, y, w, h); });
luax_pushtype(L, "ImageData", IMAGE_IMAGE_DATA_T, img);
img->release();
return 1;