Exit application when wallet variable is empty

This commit is contained in:
Sander Ferdinand 2018-03-21 03:07:38 +01:00 committed by moneromooo-monero
parent 8f368b9b3b
commit f544d9ac78
1 changed files with 23 additions and 0 deletions

View File

@ -266,6 +266,29 @@ ApplicationWindow {
function connectWallet(wallet) {
currentWallet = wallet
// TODO:
// When the wallet variable is undefined, it yields a zero balance.
// This can scare users, restart the GUI (as a quick fix).
//
// To reproduce, follow these steps:
// 1) Open the GUI, load up a wallet that has a balance
// 2) Settings -> close wallet
// 3) Create a new wallet
// 4) Settings -> close wallet
// 5) Open the wallet from step 1
if(!wallet || wallet === undefined || wallet.path === undefined){
informationPopup.title = qsTr("Error") + translationManager.emptyString;
informationPopup.text = qsTr("Couldn't open wallet: ") + 'please restart GUI.';
informationPopup.icon = StandardIcon.Critical
informationPopup.open()
informationPopup.onCloseCallback = function() {
appWindow.close();
}
return;
}
walletName = usefulName(wallet.path)
updateSyncing(false)