We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7fc57a0 commit d33b7adCopy full SHA for d33b7ad
1 file changed
HMCL/src/main/java/org/jackhuang/hmcl/setting/ConfigHolder.java
@@ -174,10 +174,17 @@ private static Config loadConfig() throws IOException {
174
return new Config();
175
}
176
177
+ try {
178
+ Config settings = Config.fromJson(jsonObject);
179
+ if (settings == null) {
180
+ return new Config();
181
+ }
182
183
+ if (!Config.CURRENT_SCHEMA_VERSION.equals(settings.getSchemaVersion())) {
184
+ settings.setSchemaVersion(Config.CURRENT_SCHEMA_VERSION);
185
186
- try {
- return Objects.requireNonNullElseGet(Config.fromJson(jsonObject), Config::new);
187
+ return settings;
188
} catch (JsonParseException e) {
189
// TODO: Save the invalid settings file to a backup location
190
LOG.warning("Failed to parse settings file: " + SETTINGS_LOCATION, e);
0 commit comments