Skip to content

Commit

Permalink
fix(neuron-wallet): set current wallet empty if wallet list is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith-CY committed Aug 2, 2019
1 parent 315623a commit b438509
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/neuron-wallet/src/services/wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ export default class WalletService {
if (currentID === id) {
if (newWallets.length > 0) {
this.setCurrent(newWallets[0].id)
} else {
this.setCurrent('')
}
}

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

const wallet = this.get(id)
if (!wallet) {
throw new WalletNotFound(id)
if (id !== '') {
const wallet = this.get(id)
if (!wallet) {
throw new WalletNotFound(id)
}
}

this.listStore.writeSync(this.currentWalletKey, id)
Expand Down

0 comments on commit b438509

Please sign in to comment.