From bb234ed852d0c4ff9c89b0826a8041fa78903385 Mon Sep 17 00:00:00 2001
From: thepaperpilot <thepaperpilot@gmail.com>
Date: Wed, 22 Feb 2023 20:26:16 -0600
Subject: [PATCH] Make persistence NaN check not activate if current value is
 NaN

---
 src/game/persistence.ts | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/game/persistence.ts b/src/game/persistence.ts
index 9ad0634..293140a 100644
--- a/src/game/persistence.ts
+++ b/src/game/persistence.ts
@@ -94,7 +94,10 @@ function getStackTrace() {
 
 function checkNaNAndWrite<T extends State>(persistent: Persistent<T>, value: T) {
     // Decimal is smart enough to return false on things that aren't supposed to be numbers
-    if (Decimal.isNaN(value as DecimalSource)) {
+    if (
+        Decimal.isNaN(value as DecimalSource) &&
+        !Decimal.isNaN(persistent.value as DecimalSource)
+    ) {
         if (!state.hasNaN) {
             player.autosave = false;
             state.hasNaN = true;