Fix potential NPE for keepassxc

This commit is contained in:
crschnick
2026-06-11 16:16:37 +00:00
parent a1e4235fb6
commit 9844e2d615
@@ -273,11 +273,11 @@ public class KeePassXcPasswordManager implements PasswordManager {
try {
var hasScheme = Pattern.compile("^\\w+://").matcher(key).find();
var fixedKey = hasScheme ? key : "https://" + key;
var isPrefs = this == AppPrefs.get().passwordManager().getValue();
var client = getOrCreateClient();
// The prefs value might be updated during the client creation
var effectiveKeys =
isPrefs ? ((KeePassXcPasswordManager) AppPrefs.get().passwordManager().getValue()).getAssociationKeys() : associationKeys;
// We should always apply the prefs value configuration
var isPrefs = this == AppPrefs.get().passwordManager().getValue();
var effectiveKeys = !isPrefs ? ((KeePassXcPasswordManager) AppPrefs.get().passwordManager().getValue()).getAssociationKeys() : associationKeys;
var credentials = client.getCredentials(effectiveKeys, fixedKey);
return Result.of(credentials, null);
} catch (Exception e) {