From 2dae27daa5c715bbc108d17b2cbaa78bdd7a0739 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Thu, 15 Feb 2024 20:04:09 -0700 Subject: [PATCH] parse-protection on miscInt and miscFloat --- src/hollywoo/Movie.kiss | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hollywoo/Movie.kiss b/src/hollywoo/Movie.kiss index 0688cf5..383deef 100644 --- a/src/hollywoo/Movie.kiss +++ b/src/hollywoo/Movie.kiss @@ -645,7 +645,9 @@ (director.enterString "Redefine $key from ${.value (miscInts.get key)}?" ->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)))) ] (set lastCommand defineMiscInt) @@ -661,7 +663,9 @@ (director.enterString "Redefine $key from ${.value (miscFloats.get key)}?" ->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)))) ] (set lastCommand defineMiscFloat)