From 519e4b9372e0c0c96bfeb59830edc5be82210eb0 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 2903e6f8cf2..89dd09bf582 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 2c38e8a40c0..78bb1f22b0a 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; }