From 05ce7086f78e344aee23bb95de56d28317074a7d Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Wed, 21 Dec 2016 17:19:53 -0800 Subject: [PATCH] Added error when trying to unlock uninitialized vault --- app/scripts/keyring-controller.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js index 1786f7c24..4e9193ab2 100644 --- a/app/scripts/keyring-controller.js +++ b/app/scripts/keyring-controller.js @@ -721,6 +721,10 @@ module.exports = class KeyringController extends EventEmitter { // initializing the persisted keyrings to RAM. unlockKeyrings (password) { const encryptedVault = this.configManager.getVault() + if (!encryptedVault) { + throw new Error('Cannot unlock without a previous vault.') + } + return this.encryptor.decrypt(password, encryptedVault) .then((vault) => { this.password = password