From 4ef6e334b05461a422606deab3b717861af6e632 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Tue, 3 Dec 2024 20:17:04 +0700 Subject: [PATCH] fix: an emergency fix that probably doesn't work --- build-number.txt | 2 +- .../chayapak1/chomens_bot/util/PersistentDataUtilities.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build-number.txt b/build-number.txt index 65150d2b..019cce38 100644 --- a/build-number.txt +++ b/build-number.txt @@ -1 +1 @@ -1153 \ No newline at end of file +1154 \ No newline at end of file diff --git a/src/main/java/me/chayapak1/chomens_bot/util/PersistentDataUtilities.java b/src/main/java/me/chayapak1/chomens_bot/util/PersistentDataUtilities.java index 0b3c59bc..c5001bbb 100644 --- a/src/main/java/me/chayapak1/chomens_bot/util/PersistentDataUtilities.java +++ b/src/main/java/me/chayapak1/chomens_bot/util/PersistentDataUtilities.java @@ -49,8 +49,10 @@ public class PersistentDataUtilities { lock.lock(); try (BufferedWriter writer = Files.newBufferedWriter(path, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) { - writer.write(gson.toJson(jsonObject)); - } catch (IOException e) { + final JsonElement copy = jsonObject.deepCopy(); + + writer.write(gson.toJson(copy)); + } catch (Exception e) { e.printStackTrace(); } finally { lock.unlock();