Fix duplicate Locations appearing in map list
Some checks failed
Build Porymap / build-linux (, 5.14.2) (push) Has been cancelled
Build Porymap / build-linux (, 6.8.*) (push) Has been cancelled
Build Porymap / build-linux (minimal, 5.14.2) (push) Has been cancelled
Build Porymap / build-macos (macos-15-intel) (push) Has been cancelled
Build Porymap / build-macos (macos-latest) (push) Has been cancelled
Build Porymap / build-static-windows (push) Has been cancelled

This commit is contained in:
GriffinR
2026-06-14 03:30:19 -04:00
parent 0327eecf5a
commit 71ff235c78
2 changed files with 7 additions and 10 deletions

View File

@@ -25,6 +25,7 @@ and this project somewhat adheres to [Semantic Versioning](https://semver.org/sp
- Fix some menu items under `Tools` not being disabled when their corresponding button is disabled.
- Fix the map list search bar stealing keyboard focus whenever a map layout was opened.
- Disallow creating prefabs with no metatiles.
- Fix new `Location` names created via the `Header` tab temporarily appearing twice after saving.
## [6.3.1] - 2026-04-12
### Added

View File

@@ -128,16 +128,8 @@ QStandardItem *MapListModel::insertMapItem(const QString &mapName, const QString
return nullptr;
QStandardItem *map = createMapItem(mapName);
QStandardItem *folder = this->mapFolderItems[folderName];
if (!folder) {
// Folder doesn't exist yet, add it.
folder = insertMapFolderItem(folderName);
}
// If folder is still nullptr here it's because we failed to create it.
if (folder) {
folder->appendRow(map);
}
QStandardItem *folder = insertMapFolderItem(folderName);
if (folder) folder->appendRow(map);
return map;
}
@@ -145,6 +137,10 @@ QStandardItem *MapListModel::insertMapFolderItem(const QString &folderName) {
if (folderName.isEmpty())
return nullptr;
// If the folder has already been inserted, don't insert it again.
auto search = this->mapFolderItems.constFind(folderName);
if (search != this->mapFolderItems.constEnd()) return search.value();
QStandardItem *item = createMapFolderItem(folderName);
this->root->appendRow(item);
return item;