Interface: Correctly handle setting a null or empty key
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
f0f9192aed
commit
529e320e3f
@ -90,10 +90,14 @@ public class Interface extends BaseObservable implements Observable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setPrivateKey(String privateKey) {
|
public void setPrivateKey(String privateKey) {
|
||||||
// Avoid exceptions from Keypair while the user is typing.
|
if (privateKey != null && !privateKey.isEmpty()) {
|
||||||
if (privateKey.length() != KeyEncoding.KEY_LENGTH_BASE64)
|
// Avoid exceptions from Keypair while the user is typing.
|
||||||
return;
|
if (privateKey.length() != KeyEncoding.KEY_LENGTH_BASE64)
|
||||||
keypair = new Keypair(privateKey);
|
return;
|
||||||
|
keypair = new Keypair(privateKey);
|
||||||
|
} else {
|
||||||
|
keypair = null;
|
||||||
|
}
|
||||||
notifyPropertyChanged(BR.privateKey);
|
notifyPropertyChanged(BR.privateKey);
|
||||||
notifyPropertyChanged(BR.publicKey);
|
notifyPropertyChanged(BR.publicKey);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user