mirror of
https://github.com/love2d/love.git
synced 2026-08-20 04:30:09 +02:00
Fixed a crash when Canvas:newImageData should error.
--HG-- branch : minor
This commit is contained in:
@@ -132,10 +132,7 @@ public:
|
|||||||
|
|
||||||
struct ColorMask
|
struct ColorMask
|
||||||
{
|
{
|
||||||
bool r;
|
bool r, g, b, a;
|
||||||
bool g;
|
|
||||||
bool b;
|
|
||||||
bool a;
|
|
||||||
|
|
||||||
bool operator == (const ColorMask &m) const
|
bool operator == (const ColorMask &m) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -71,7 +71,9 @@ int w_Canvas_newImageData(lua_State *L)
|
|||||||
int w = luaL_optint(L, 4, canvas->getWidth());
|
int w = luaL_optint(L, 4, canvas->getWidth());
|
||||||
int h = luaL_optint(L, 5, canvas->getHeight());
|
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);
|
luax_pushtype(L, "ImageData", IMAGE_IMAGE_DATA_T, img);
|
||||||
img->release();
|
img->release();
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user