From 9189d4d21e8c4642309b727fbc29ef91cc659d8c Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Tue, 15 Feb 2022 16:11:44 +0100 Subject: [PATCH] Improve null checks in content scripts (#2390) --- src/content/autofiller.ts | 2 +- src/content/notificationBar.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/autofiller.ts b/src/content/autofiller.ts index 2903e6f8cf..89dd09bf58 100644 --- a/src/content/autofiller.ts +++ b/src/content/autofiller.ts @@ -14,7 +14,7 @@ document.addEventListener("DOMContentLoaded", (event) => { }); chrome.storage.local.get(activeUserId, (obj: any) => { - if (obj != null && obj[activeUserId].settings.enableAutoFillOnPageLoad === true) { + if (obj?.[activeUserId]?.settings?.enableAutoFillOnPageLoad === true) { setInterval(() => doFillIfNeeded(), 500); } }); diff --git a/src/content/notificationBar.ts b/src/content/notificationBar.ts index ecc6e61c92..425d70be63 100644 --- a/src/content/notificationBar.ts +++ b/src/content/notificationBar.ts @@ -58,7 +58,7 @@ document.addEventListener("DOMContentLoaded", (event) => { }); chrome.storage.local.get(activeUserId, (obj: any) => { - if (obj === null) { + if (obj?.[activeUserId] == null) { return; }