Fixed issue where the SettingsRegistryImpl::LessThan function would set the collisionFound boolean to true when comparing two elements that happened to be at the same address via std::sort. (#857)

In reality there is no such collision and the comparisons needs to early return with false, but not change the collisionFound flag.
This commit is contained in:
lumberyard-employee-dm
2021-05-20 20:41:30 -05:00
committed by GitHub
parent 5d162a9a63
commit 8028cbbe39
@@ -880,6 +880,13 @@ namespace AZ
const Specializations& specializations, const rapidjson::Pointer& historyPointer, AZStd::string_view folderPath)
{
using namespace rapidjson;
if (&lhs == &rhs)
{
// Early return to avoid setting the collisionFound reference to true
// std::sort is allowed to pass in the same memory address for the left and right elements
return false;
}
AZ_Assert(!lhs.m_tags.empty(), "Comparing a settings file without at least a name tag.");
AZ_Assert(!rhs.m_tags.empty(), "Comparing a settings file without at least a name tag.");