Check for empty prefs

This commit is contained in:
crschnick committed 2025-06-10 14:29:18 +00:00
1 parent c4979a50f5
commit 53ccf2c967
1 file changed
+7 -3
@@ -47,9 +47,13 @@ public class AppPrefsStorageHandler {
if (content == null) {
if (Files.exists(file)) {
try {
ObjectMapper o = JacksonMapper.getDefault();
var read = o.readTree(Files.readAllBytes(file));
content = read.isObject() ? (ObjectNode) read : null;
var s = Files.readString(file);
if (!s.isEmpty()) {
var read = JacksonMapper.getDefault().readTree(s);
if (read.isObject()) {
content = (ObjectNode) read;
}
}
} catch (IOException e) {
ErrorEvent.fromThrowable(e).handle();
}