mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-29 19:20:09 +00:00
Add extra check/asserts to detect/avoid a reported crash in draw_image_into_new_tilemap_cel (fix #2770)
This commit is contained in:
parent
b83f2953f9
commit
5ae7076d65
@ -425,9 +425,15 @@ void draw_image_into_new_tilemap_cel(
|
||||
delete addTile;
|
||||
}
|
||||
|
||||
newTilemap->putPixel(
|
||||
tilePt.x-tilemapBounds.x,
|
||||
tilePt.y-tilemapBounds.y, tileIndex);
|
||||
// We were using newTilemap->putPixel() directly but received a
|
||||
// crash report about an "access violation". So now we've added
|
||||
// some checks to the operation.
|
||||
{
|
||||
const int u = tilePt.x-tilemapBounds.x;
|
||||
const int v = tilePt.y-tilemapBounds.y;
|
||||
ASSERT((u >= 0) && (v >= 0) && (u < newTilemap->width()) && (v < newTilemap->height()));
|
||||
doc::put_pixel(newTilemap.get(), u, v, tileIndex);
|
||||
}
|
||||
}
|
||||
|
||||
static_cast<Doc*>(dstLayer->sprite()->document())
|
||||
|
Loading…
x
Reference in New Issue
Block a user