mirror of
https://github.com/love2d/love.git
synced 2026-08-19 12:14:20 +02:00
Properly catch exceptions thrown by ImageData:getPixel/setPixel, thereby preventing an uncaught exception for an invalid index. (Bug #381)
This commit is contained in:
@@ -56,9 +56,9 @@ namespace image
|
|||||||
{
|
{
|
||||||
c = t->getPixel(x, y);
|
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.r);
|
||||||
lua_pushnumber(L, c.g);
|
lua_pushnumber(L, c.g);
|
||||||
@@ -81,9 +81,9 @@ namespace image
|
|||||||
{
|
{
|
||||||
t->setPixel(x, y, c);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user