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();
|
||||
std::vector<ImageRef> tilemaps;
|
||||
sprite->getTilemapsByTileset(tileset, tilemaps);
|
||||
PalettePicks usedTiles(tileset->size());
|
||||
|
||||
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;
|
||||
const int n = std::max(m_oldTileset->size(),
|
||||
tileset->size());
|
||||
PalettePicks usedTiles(n);
|
||||
|
||||
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
|
||||
const int n = std::max(m_oldTileset->size(),
|
||||
tileset->size());
|
||||
Remap remap(n);
|
||||
bool existMapToEmpty = false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user