From 8049c1fc07c248d978ced12746e26e1b3f2eb003 Mon Sep 17 00:00:00 2001 From: kumavis Date: Tue, 24 Jan 2017 13:21:55 -0800 Subject: keyring-controller - cleanup --- app/scripts/keyring-controller.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'app') diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js index 7a46c7737..858ea19ee 100644 --- a/app/scripts/keyring-controller.js +++ b/app/scripts/keyring-controller.js @@ -423,11 +423,9 @@ module.exports = class KeyringController extends EventEmitter { createFirstKeyTree () { this.clearKeyrings() return this.addNewKeyring('HD Key Tree', {numberOfAccounts: 1}) - .then(() => { - return this.keyrings[0].getAccounts() - }) - .then((accounts) => { - const firstAccount = accounts[0] + .then((keyring) => { + const firstAccount = keyring.getAccounts()[0] + if (!firstAccount) throw new Error('KeyringController - No account found on keychain.') const hexAccount = normalize(firstAccount) this.configManager.setSelectedAccount(hexAccount) this.emit('newAccount', hexAccount) -- cgit v1.2.3