Skip to content

Commit b438509

Browse files
committed
fix(neuron-wallet): set current wallet empty if wallet list is empty
1 parent 315623a commit b438509

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

packages/neuron-wallet/src/services/wallets.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@ export default class WalletService {
245245
if (currentID === id) {
246246
if (newWallets.length > 0) {
247247
this.setCurrent(newWallets[0].id)
248+
} else {
249+
this.setCurrent('')
248250
}
249251
}
250252

@@ -258,9 +260,11 @@ export default class WalletService {
258260
throw new IsRequired('ID')
259261
}
260262

261-
const wallet = this.get(id)
262-
if (!wallet) {
263-
throw new WalletNotFound(id)
263+
if (id !== '') {
264+
const wallet = this.get(id)
265+
if (!wallet) {
266+
throw new WalletNotFound(id)
267+
}
264268
}
265269

266270
this.listStore.writeSync(this.currentWalletKey, id)

0 commit comments

Comments
 (0)