Prefs fix

This commit is contained in:
crschnick 2023-04-19 06:07:12 +00:00
parent d464118d83
commit 097a463e0e
2 changed files with 3 additions and 2 deletions

View file

@ -119,7 +119,7 @@ public class AppPrefs {
// ==== // ====
private final Property<SecretValue> lockPassword = new SimpleObjectProperty<SecretValue>(); private final Property<SecretValue> lockPassword = new SimpleObjectProperty<SecretValue>();
private final StringProperty lockCrypt = typed(new SimpleStringProperty(null), String.class); private final StringProperty lockCrypt = typed(new SimpleStringProperty(""), String.class);
private final StringField lockCryptControl = StringField.ofStringType(lockCrypt).render(() -> new SimpleControl<StringField, StackPane>() { private final StringField lockCryptControl = StringField.ofStringType(lockCrypt).render(() -> new SimpleControl<StringField, StackPane>() {
private Region button; private Region button;

View file

@ -2,6 +2,7 @@ package io.xpipe.app.prefs;
import com.dlsc.preferencesfx.util.StorageHandler; import com.dlsc.preferencesfx.util.StorageHandler;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.NullNode;
import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.node.TextNode; import com.fasterxml.jackson.databind.node.TextNode;
import com.fasterxml.jackson.databind.type.CollectionType; import com.fasterxml.jackson.databind.type.CollectionType;
@ -50,7 +51,7 @@ public class JsonStorageHandler implements StorageHandler {
var id = getSaveId(breadcrumb); var id = getSaveId(breadcrumb);
var tree = object instanceof PrefsChoiceValue prefsChoiceValue var tree = object instanceof PrefsChoiceValue prefsChoiceValue
? new TextNode(prefsChoiceValue.getId()) ? new TextNode(prefsChoiceValue.getId())
: JacksonMapper.newMapper().valueToTree(object); : (object != null ? JacksonMapper.newMapper().valueToTree(object) : NullNode.getInstance());
setContent(id, tree); setContent(id, tree);
} }