From b6a5180a6aa7c13e4a56c86aa3a4c0520f200480 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 29 Nov 2017 10:06:02 -0500 Subject: [PATCH] dont throw error on none found --- src/services/autofill.service.ts | 7 +++---- src/services/cipher.service.ts | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 2767d262f2..e286369bba 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -206,14 +206,13 @@ export default class AutofillService { return; } - const cipher = await this.cipherService.getLastUsedForDomain(tabDomain); - if (!cipher) { + const lastUsedCipher = await this.cipherService.getLastUsedForDomain(tabDomain); + if (!lastUsedCipher) { return; } await this.doAutoFill({ - // tslint:disable-next-line - cipher: cipher, + cipher: lastUsedCipher, // tslint:disable-next-line pageDetails: pageDetails, fromBackground: true, diff --git a/src/services/cipher.service.ts b/src/services/cipher.service.ts index 69650cf113..7b0d5d08b2 100644 --- a/src/services/cipher.service.ts +++ b/src/services/cipher.service.ts @@ -235,7 +235,7 @@ export default class CipherService { async getLastUsedForDomain(domain: string): Promise { const ciphers = await this.getAllDecryptedForDomain(domain); if (ciphers.length === 0) { - throw new Error('No ciphers.'); + return null; } const sortedCiphers = ciphers.sort(CipherService.sortCiphersByLastUsed);