3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-03 14:50:30 +01:00

Fix unquoted string being parsed as double

Dieser Commit ist enthalten in:
Nassim Jahnke 2021-11-05 18:19:14 +01:00
Ursprung 8104b96b8c
Commit 52457ea749
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B

Datei anzeigen

@ -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
}
}
}
}