소스 검색

Fix crash if ID not exists

Laserlicht 2 달 전
부모
커밋
f7adb39551
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  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);