Browse Source

Merge pull request #6030 from Laserlicht/patch-2

Fix crash if ID not exists
Ivan Savenko 2 months ago
parent
commit
b5b548d532
1 changed files with 2 additions and 1 deletions
  1. 2 1
      lib/modding/IdentifierStorage.cpp

+ 2 - 1
lib/modding/IdentifierStorage.cpp

@@ -418,7 +418,8 @@ std::vector<CIdentifierStorage::ObjectData> CIdentifierStorage::getPossibleIdent
 	}
 
 	std::string fullID = request.type + '.' + request.name;
-	std::string fullIDCaseCorrected = request.caseSensitive ? fullID : registeredObjectsCaseLookup.at(boost::algorithm::to_lower_copy(fullID));
+	std::string fullLowerID = boost::algorithm::to_lower_copy(fullID);
+	std::string fullIDCaseCorrected = (request.caseSensitive || !registeredObjectsCaseLookup.count(fullLowerID)) ? fullID : registeredObjectsCaseLookup.at(fullLowerID);
 
 	auto entries = registeredObjects.equal_range(fullIDCaseCorrected);