mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Fix a crash in Image:replacePixels when a different ImageData is given than the one that created the Image.
This commit is contained in:
@@ -52,6 +52,7 @@ int w_Image_replacePixels(lua_State *L)
|
||||
|
||||
int slice = 0;
|
||||
int mipmap = 0;
|
||||
Rect r = {0, 0, id->getWidth(), id->getHeight()};
|
||||
bool reloadmipmaps = i->getMipmapsType() == Image::MIPMAPS_GENERATED;
|
||||
|
||||
if (i->getTextureType() != TEXTURE_2D)
|
||||
@@ -63,7 +64,7 @@ int w_Image_replacePixels(lua_State *L)
|
||||
else if (!reloadmipmaps)
|
||||
mipmap = (int) luaL_optinteger(L, 3, 1) - 1;
|
||||
|
||||
luax_catchexcept(L, [&](){ i->replacePixels(id, slice, mipmap, reloadmipmaps); });
|
||||
luax_catchexcept(L, [&](){ i->replacePixels(id, slice, mipmap, r, reloadmipmaps); });
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user