parse-protection on miscInt and miscFloat
This commit is contained in:
@@ -645,7 +645,9 @@
|
|||||||
(director.enterString "Redefine $key from ${.value (miscInts.get key)}?"
|
(director.enterString "Redefine $key from ${.value (miscInts.get key)}?"
|
||||||
->valStr
|
->valStr
|
||||||
(let [v (Std.parseInt valStr)]
|
(let [v (Std.parseInt valStr)]
|
||||||
(miscInts.put key (new HInt v))
|
(if (= v null)
|
||||||
|
(print "Failed to parse ${valStr}. leaving value the same")
|
||||||
|
(miscInts.put key (new HInt v)))
|
||||||
(cc))))
|
(cc))))
|
||||||
]
|
]
|
||||||
(set lastCommand defineMiscInt)
|
(set lastCommand defineMiscInt)
|
||||||
@@ -661,7 +663,9 @@
|
|||||||
(director.enterString "Redefine $key from ${.value (miscFloats.get key)}?"
|
(director.enterString "Redefine $key from ${.value (miscFloats.get key)}?"
|
||||||
->valStr
|
->valStr
|
||||||
(let [v (Std.parseFloat valStr)]
|
(let [v (Std.parseFloat valStr)]
|
||||||
(miscFloats.put key (new HFloat v))
|
(if (Math.isNaN v)
|
||||||
|
(print "Failed to parse ${valStr}. leaving value the same")
|
||||||
|
(miscFloats.put key (new HFloat v)))
|
||||||
(cc))))
|
(cc))))
|
||||||
]
|
]
|
||||||
(set lastCommand defineMiscFloat)
|
(set lastCommand defineMiscFloat)
|
||||||
|
Reference in New Issue
Block a user