From a2f5c16c4e3f62f0404fa591bd5b941aaefaa6b3 Mon Sep 17 00:00:00 2001 From: MATRIX-feather Date: Thu, 14 Nov 2024 17:43:35 +0800 Subject: [PATCH] Fix MorphMessageStore throwing NPE --- .../xyz/nifeather/morph/messages/MorphMessageStore.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/xyz/nifeather/morph/messages/MorphMessageStore.java b/src/main/java/xyz/nifeather/morph/messages/MorphMessageStore.java index 71508155..7832e27b 100644 --- a/src/main/java/xyz/nifeather/morph/messages/MorphMessageStore.java +++ b/src/main/java/xyz/nifeather/morph/messages/MorphMessageStore.java @@ -152,7 +152,12 @@ public String get(String key, @Nullable String defaultValue, @Nullable String lo for (var store : messageStores) { - var msg = store.get(key, null, null); + var msg = store.get(key, "NIL", null); + + // Since we use ConcurrentHashMap, we no longer can use NULL as the default value + // So this might be the only way. Solving this would require a PluginBase update. + if (msg.equals("NIL")) msg = null; + if (msg != null) return msg; }