Don't allow non-finite doubles and floats
This commit is contained in:
parent
81519542e8
commit
3627d7e88f
@ -25,7 +25,9 @@ public class TypeDouble extends TypeAbstractNumber<Double>
|
|||||||
@Override
|
@Override
|
||||||
public Double valueOf(String arg, CommandSender sender) throws Exception
|
public Double valueOf(String arg, CommandSender sender) throws Exception
|
||||||
{
|
{
|
||||||
return Double.parseDouble(arg);
|
var ret = Double.parseDouble(arg);
|
||||||
|
if (!Double.isFinite(ret)) throw new Exception();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,9 @@ public class TypeFloat extends TypeAbstractNumber<Float>
|
|||||||
@Override
|
@Override
|
||||||
public Float valueOf(String arg, CommandSender sender) throws Exception
|
public Float valueOf(String arg, CommandSender sender) throws Exception
|
||||||
{
|
{
|
||||||
return Float.parseFloat(arg);
|
var ret = Float.parseFloat(arg);
|
||||||
|
if (!Float.isFinite(ret)) throw new Exception();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user