From 8b7c7ecb33cb79281e06fe911220b49d80fcadb1 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Wed, 7 Dec 2022 21:34:45 -0800 Subject: [PATCH] Better number handling --- src/App.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/App.tsx b/src/App.tsx index c1c205b..63cd590 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -39,8 +39,13 @@ function Addresses(props: AddressesProps) { setInputState(""); } - const num = isNaN(numTokens) ? 0 : numTokens; + var num; + if (isNan(numTokens) || numTokens < 0) { + num = 0; + } else { + num = numTokens; + } return (