Fix unquoted string being parsed as double

This commit is contained in:
Nassim Jahnke 2021-11-05 18:19:14 +01:00
parent 8104b96b8c
commit 52457ea749
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B

View File

@ -47,7 +47,6 @@ import java.util.stream.LongStream;
// - Use OpenNBT tags
// - Small byteArray() optimization
// - acceptLegacy = true by default
// - Don't parse value as DoubleTag when possiblyNumeric
final class TagStringReader {
private static final int MAX_DEPTH = 512;
private static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
@ -306,7 +305,13 @@ final class TagStringReader {
try {
return new IntTag(Integer.parseInt(built));
} catch (final NumberFormatException ex) {
// Via - don't try to parse as DoubleTag her
if (built.indexOf('.') != -1) {
try {
return new DoubleTag(Double.parseDouble(built));
} catch (final NumberFormatException ex2) {
// ignore
}
}
}
}