Core/ChatCommands: Honor exact matches during enum arg parsing (PR #25255)

This commit is contained in:
Peter Keresztes Schmidt
2020-08-16 16:27:19 +02:00
committed by GitHub
parent 86dc58974a
commit df29f60595

View File

@@ -142,10 +142,13 @@ struct ArgInfo<T, std::enable_if_t<std::is_enum_v<T>>>
if (it == SearchMap.end() || !StringStartsWith(it->first, s)) // not a match
return nullptr;
auto it2 = it;
++it2;
if (it2 != SearchMap.end() && StringStartsWith(it2->first, s)) // not unique
return nullptr;
if (it->first != s) // we don't have an exact match - check if it is unique
{
auto it2 = it;
++it2;
if (it2 != SearchMap.end() && StringStartsWith(it2->first, s)) // not unique
return nullptr;
}
if (it->second)
return &*it->second;