Fix tileset palette saving crash

This commit is contained in:
GriffinR 2024-12-04 15:41:29 -05:00
parent 59c525e9fe
commit c2cf3cc9c7
2 changed files with 3 additions and 1 deletions

View file

@ -58,6 +58,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
- Fix some file dialogs returning to an incorrect window when closed.
- Fix bug where reloading a layout would overwrite all unsaved changes.
- Fix bug where layout json and blockdata could be saved separately leading to inconsistent data.
- Fix crash when saving tilesets with fewer palettes than the maximum.
## [5.4.1] - 2024-03-21
### Fixed

View file

@ -1130,7 +1130,8 @@ void Project::saveTilesetTilesImage(Tileset *tileset) {
}
void Project::saveTilesetPalettes(Tileset *tileset) {
for (int i = 0; i < Project::getNumPalettesTotal(); i++) {
int numPalettes = qMin(tileset->palettePaths.length(), tileset->palettes.length());
for (int i = 0; i < numPalettes; i++) {
QString filepath = tileset->palettePaths.at(i);
PaletteUtil::writeJASC(filepath, tileset->palettes.at(i).toVector(), 0, 16);
}