fixed bugs, memory leaks, etc
This commit is contained in:
1 parent
aa4f6b6ddc
commit
c3f8f23c1d
124 files changed
+1060
-420
No files matched your search
@@ -88,6 +88,10 @@ public final class LocalConfigs {
|
||||
Entry e = GSON.fromJson(Files.readString(p, StandardCharsets.UTF_8), Entry.class);
|
||||
if (e == null || e.name == null || e.name.isBlank()) continue;
|
||||
if (e.tags == null) e.tags = new ArrayList<>();
|
||||
e.tags.removeIf(java.util.Objects::isNull);
|
||||
if (e.desc == null) e.desc = "";
|
||||
if (e.author == null) e.author = "";
|
||||
if (e.date == null) e.date = "";
|
||||
ALL.add(e);
|
||||
} catch (Throwable t) { System.out.println("[prestige-ui] config " + p.getFileName() + ": " + t); }
|
||||
}
|
||||
@@ -174,7 +178,8 @@ public final class LocalConfigs {
|
||||
e.date = LocalDate.now().toString();
|
||||
e.visibility = CreateConfigPage.visibility;
|
||||
for (int i = 0; i < CreateConfigPage.TAGS.length; i++) if (CreateConfigPage.tagSel[i]) e.tags.add(CreateConfigPage.TAGS[i]);
|
||||
e.data = GSON.fromJson(snap, JsonObject.class);
|
||||
try { e.data = GSON.fromJson(snap, JsonObject.class); }
|
||||
catch (RuntimeException ex) { System.out.println("[prestige-ui] config snapshot: " + ex); WidgetsPage.toast("Could not create config"); return; }
|
||||
write(e);
|
||||
ALL.add(0, e);
|
||||
CreateConfigPage.name.setLength(0);
|
||||
@@ -210,7 +215,8 @@ public final class LocalConfigs {
|
||||
Entry e = find(c);
|
||||
String snap = snapshot();
|
||||
if (e == null || snap == null) { WidgetsPage.toast("Could not update config"); return; }
|
||||
e.data = GSON.fromJson(snap, JsonObject.class);
|
||||
try { e.data = GSON.fromJson(snap, JsonObject.class); }
|
||||
catch (RuntimeException ex) { System.out.println("[prestige-ui] config snapshot: " + ex); WidgetsPage.toast("Could not update config"); return; }
|
||||
e.date = LocalDate.now().toString();
|
||||
write(e);
|
||||
rebuild();
|
||||
|
||||
Reference in new issue
Block a user