fix(@desktop/wallet): fixed crash while handling received removed account from a paired device

This commit is contained in:
Sale Djenic 2023-08-22 11:56:11 +02:00 committed by saledjenic
parent c469cb32d3
commit 3113fffef9
1 changed files with 3 additions and 2 deletions

View File

@ -607,8 +607,9 @@ proc handleKeypair(self: Service, keypair: KeypairDto) =
localKp.lastUsedDerivationIndex = keypair.lastUsedDerivationIndex
localKp.syncedFrom = keypair.syncedFrom
# - first remove removed accounts from the UI
for localAcc in localKp.accounts:
let accAddress = localAcc.address
let addresses = localKp.accounts.map(a => a.address)
for address in addresses:
let accAddress = address
if keypair.accounts.filter(a => cmpIgnoreCase(a.address, accAddress) == 0).len == 0:
self.handleWalletAccount(WalletAccountDto(address: accAddress, removed: true), notify = false)
# - second add/update new/existing accounts