mirror of
https://github.com/RustyRaptor/xpipe.git
synced 2026-12-03 21:05:15 -07:00
Check for empty prefs
This commit is contained in:
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();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user