fix: Fixes negative numbers in commands (#1343)

This commit is contained in:
Kamron Batman 2023-02-17 00:34:24 -08:00 committed by GitHub
parent 8a0b6c9731
commit 5fd0e94b7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -187,11 +187,14 @@ namespace Server
return null;
}
if (IsNumeric(type))
if (value.StartsWithOrdinal("0x") && IsNumeric(type))
{
try
{
constructed = Convert.ChangeType(Convert.ToUInt64(value), type);
if (ulong.TryParse(value.AsSpan(2), NumberStyles.HexNumber, null, out var num))
{
constructed = Convert.ChangeType(num, type);
}
return null;
}
catch