From bdaf122ec7b35f11544b0e1abab3c92c7a23ce5c Mon Sep 17 00:00:00 2001 From: Anthony Laibe Date: Mon, 24 Apr 2023 18:20:27 +0200 Subject: [PATCH] fix(@wallet): delete selected account --- src/app/modules/main/wallet_section/overview/module.nim | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/modules/main/wallet_section/overview/module.nim b/src/app/modules/main/wallet_section/overview/module.nim index 1543ed9eb4..6ae66ccef8 100644 --- a/src/app/modules/main/wallet_section/overview/module.nim +++ b/src/app/modules/main/wallet_section/overview/module.nim @@ -95,9 +95,11 @@ proc setBalance(self: Module, tokens: seq[WalletTokenDto]) = # TODO(alaibe): replace with filter logic method switchAccount*(self: Module, accountIndex: int) = + var walletAccount = self.controller.getWalletAccount(accountIndex) self.currentAccountIndex = accountIndex - - let walletAccount = self.controller.getWalletAccount(accountIndex) + if walletAccount.isNil: + self.currentAccountIndex = 0 + walletAccount = self.controller.getWalletAccount(self.currentAccountIndex) let item = initItem( walletAccount.name, @@ -133,4 +135,5 @@ proc onAccountAdded(self: Module, account: WalletAccountDto) = self.switchAccount(self.currentAccountIndex) proc onAccountRemoved(self: Module, account: WalletAccountDto) = - self.switchAccount(self.currentAccountIndex) \ No newline at end of file + self.switchAccount(self.currentAccountIndex) + \ No newline at end of file