fix crash when no ledger connected (#463)
This commit is contained in:
parent
dc86f0469e
commit
29583fa40d
|
@ -193,6 +193,7 @@ public class LoginActivity extends BaseActivity
|
|||
Helper.promptPassword(LoginActivity.this, walletName, true, new Helper.PasswordAction() {
|
||||
@Override
|
||||
public void action(String walletName, String password, boolean fingerprintUsed) {
|
||||
if (checkDevice(walletName, password))
|
||||
startDetails(walletFile, password, GenerateReviewFragment.VIEW_TYPE_DETAILS);
|
||||
}
|
||||
});
|
||||
|
@ -225,6 +226,7 @@ public class LoginActivity extends BaseActivity
|
|||
Helper.promptPassword(LoginActivity.this, walletName, false, new Helper.PasswordAction() {
|
||||
@Override
|
||||
public void action(String walletName, String password, boolean fingerprintUsed) {
|
||||
if (checkDevice(walletName, password))
|
||||
startReceive(walletFile, password);
|
||||
}
|
||||
});
|
||||
|
@ -1160,14 +1162,7 @@ public class LoginActivity extends BaseActivity
|
|||
}
|
||||
}
|
||||
|
||||
void promptAndStart(WalletNode walletNode) {
|
||||
File walletFile = Helper.getWalletFile(this, walletNode.getName());
|
||||
if (WalletManager.getInstance().walletExists(walletFile)) {
|
||||
WalletManager.getInstance().setDaemon(walletNode);
|
||||
Helper.promptPassword(LoginActivity.this, walletNode.getName(), false,
|
||||
new Helper.PasswordAction() {
|
||||
@Override
|
||||
public void action(String walletName, String password, boolean fingerprintUsed) {
|
||||
boolean checkDevice(String walletName, String password) {
|
||||
String keyPath = new File(Helper.getWalletRoot(LoginActivity.this),
|
||||
walletName + ".keys").getAbsolutePath();
|
||||
// check if we need connected hardware
|
||||
|
@ -1178,14 +1173,28 @@ public class LoginActivity extends BaseActivity
|
|||
if (!hasLedger()) {
|
||||
toast(R.string.open_wallet_ledger_missing);
|
||||
} else {
|
||||
startWallet(walletName, password, fingerprintUsed);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// device could be undefined meaning the password is wrong
|
||||
// this gets dealt with later
|
||||
startWallet(walletName, password, fingerprintUsed);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void promptAndStart(WalletNode walletNode) {
|
||||
File walletFile = Helper.getWalletFile(this, walletNode.getName());
|
||||
if (WalletManager.getInstance().walletExists(walletFile)) {
|
||||
WalletManager.getInstance().setDaemon(walletNode);
|
||||
Helper.promptPassword(LoginActivity.this, walletNode.getName(), false,
|
||||
new Helper.PasswordAction() {
|
||||
@Override
|
||||
public void action(String walletName, String password, boolean fingerprintUsed) {
|
||||
if (checkDevice(walletName, password))
|
||||
startWallet(walletName, password, fingerprintUsed);
|
||||
|
||||
}
|
||||
});
|
||||
} else { // this cannot really happen as we prefilter choices
|
||||
|
|
Loading…
Reference in New Issue