Fix crash when adding first MAPSEC define

This commit is contained in:
GriffinR
2025-03-18 23:51:38 -04:00
parent a406f4c210
commit d555347323

View File

@@ -2357,7 +2357,7 @@ bool Project::addNewMapsec(const QString &idName, const QString &displayName) {
return false;
}
if (this->mapSectionIdNamesSaveOrder.last() == getEmptyMapsecName()) {
if (!this->mapSectionIdNamesSaveOrder.isEmpty() && this->mapSectionIdNamesSaveOrder.last() == getEmptyMapsecName()) {
// If the default map section name (MAPSEC_NONE) is last in the list we'll keep it last in the list.
this->mapSectionIdNamesSaveOrder.insert(this->mapSectionIdNames.length() - 1, idName);
} else {