diff --git a/common/src/main/java/revxrsal/commands/stream/MutableStringStreamImpl.java b/common/src/main/java/revxrsal/commands/stream/MutableStringStreamImpl.java index 051d6295..4fc8bd46 100644 --- a/common/src/main/java/revxrsal/commands/stream/MutableStringStreamImpl.java +++ b/common/src/main/java/revxrsal/commands/stream/MutableStringStreamImpl.java @@ -133,7 +133,9 @@ public void extend(@NotNull String str) { public float readFloat() { String value = readUnquotedString(); try { - return Float.parseFloat(value); + float v = Float.parseFloat(value); + if (Float.isFinite(v)) return v; + throw new InvalidDecimalException(value); } catch (NumberFormatException e) { throw new InvalidDecimalException(value); } @@ -142,7 +144,9 @@ public float readFloat() { public double readDouble() { String value = readUnquotedString(); try { - return Double.parseDouble(value); + double v = Double.parseDouble(value); + if (Double.isFinite(v)) return v; + throw new InvalidDecimalException(value); } catch (NumberFormatException e) { throw new InvalidDecimalException(value); }