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

This commit is contained in:
Peter Keresztes Schmidt
2020-08-23 21:19:44 +02:00
committed by GitHub
parent 1aceb41349
commit 6079bc7f34

View File

@@ -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);