Core/ChatCommands: Do not try to consume integral types if the token is empty (PR #25320)

(cherry picked from commit 6079bc7f34250e65efa3dcbe5471382b217ebf24)
This commit is contained in:
Peter Keresztes Schmidt
2022-02-04 00:27:12 +01:00
committed by Shauren
parent 1f34964df4
commit 0257cdc8ca
@@ -55,6 +55,9 @@ struct ArgInfo<T, std::enable_if_t<std::is_integral_v<T>>>
char const* next = args;
std::string_view token(args, Trinity::Impl::ChatCommands::tokenize(next));
if (!token.length())
return nullptr;
std::from_chars_result result;
if (StringStartsWith(token, "0x"))
result = std::from_chars(token.data() + 2, token.data() + token.length(), val, 16);