From 9620ae44f61e274b6f888f175f4c0332cbd3383e Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sat, 9 Mar 2019 01:51:13 +0100 Subject: [PATCH] Config fix Saving primitive defaults even if def is null --- .../main/java/buttondevteam/lib/architecture/ConfigData.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ButtonCore/src/main/java/buttondevteam/lib/architecture/ConfigData.java b/ButtonCore/src/main/java/buttondevteam/lib/architecture/ConfigData.java index 8cff0f9..a86c071 100644 --- a/ButtonCore/src/main/java/buttondevteam/lib/architecture/ConfigData.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/architecture/ConfigData.java @@ -56,7 +56,10 @@ public class ConfigData { //TODO: Save after a while val = primitiveDef; } if (!saved && Objects.equals(val, primitiveDef)) { //String needs .equals() - set(def); //Save default value - def is always set + if (def == null && config != null) //In Discord's case def may be null + config.set(path, primitiveDef); + else + set(def); //Save default value - def is always set saved = true; } if (getter != null) {