mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-18 20:42:31 +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;
|
delete addTile;
|
||||||
}
|
}
|
||||||
|
|
||||||
newTilemap->putPixel(
|
// We were using newTilemap->putPixel() directly but received a
|
||||||
tilePt.x-tilemapBounds.x,
|
// crash report about an "access violation". So now we've added
|
||||||
tilePt.y-tilemapBounds.y, tileIndex);
|
// 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())
|
static_cast<Doc*>(dstLayer->sprite()->document())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user