mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-01 18:00:26 +00:00
Fix crash deleting all tiles from tileset and remapping
This commit is contained in:
parent
7f487c1294
commit
4db4e77c78
@ -813,17 +813,20 @@ void ColorBar::onRemapTilesButtonClick()
|
|||||||
doc::Tileset* tileset = m_tilesView.tileset();
|
doc::Tileset* tileset = m_tilesView.tileset();
|
||||||
std::vector<ImageRef> tilemaps;
|
std::vector<ImageRef> tilemaps;
|
||||||
sprite->getTilemapsByTileset(tileset, tilemaps);
|
sprite->getTilemapsByTileset(tileset, tilemaps);
|
||||||
PalettePicks usedTiles(tileset->size());
|
|
||||||
|
|
||||||
for (const ImageRef& tilemap : tilemaps) {
|
const int n = std::max(m_oldTileset->size(),
|
||||||
for (const doc::tile_t t : LockImageBits<TilemapTraits>(tilemap.get()))
|
tileset->size());
|
||||||
if (t != doc::tile_i_notile)
|
PalettePicks usedTiles(n);
|
||||||
usedTiles[doc::tile_geti(t)] = true;
|
|
||||||
|
if (n > 0) {
|
||||||
|
for (const ImageRef& tilemap : tilemaps) {
|
||||||
|
for (const doc::tile_t t : LockImageBits<TilemapTraits>(tilemap.get()))
|
||||||
|
if (t != doc::tile_i_notile)
|
||||||
|
usedTiles[doc::tile_geti(t)] = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remap all tiles in the same order as in newTileset
|
// Remap all tiles in the same order as in newTileset
|
||||||
const int n = std::max(m_oldTileset->size(),
|
|
||||||
tileset->size());
|
|
||||||
Remap remap(n);
|
Remap remap(n);
|
||||||
bool existMapToEmpty = false;
|
bool existMapToEmpty = false;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user