Skip to content

Commit 3da1e16

Browse files
JohnDupreyCopilot
andcommitted
Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: John Duprey <jwd@johnwduprey.com>
1 parent e6a906f commit 3da1e16

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

scripts/content.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2434,13 +2434,17 @@ if (window.checkExtensionLoaded) {
24342434
// Load configuration from background (includes merged enterprise policies)
24352435
const config = await new Promise((resolve) => {
24362436
chrome.runtime.sendMessage({ type: "GET_CONFIG" }, (response) => {
2437-
if (response && response.success && response.config) {
2438-
resolve(response.config);
2439-
} else {
2440-
// Fallback to local storage if background not available
2437+
if (chrome.runtime.lastError || !response || !response.success || !response.config) {
2438+
// Optionally log the error for debugging
2439+
if (chrome.runtime.lastError) {
2440+
logger.log(`[M365-Protection] Error getting config from background: ${chrome.runtime.lastError.message}`);
2441+
}
2442+
// Fallback to local storage if background not available or response invalid
24412443
chrome.storage.local.get(["config"], (result) => {
24422444
resolve(result.config || {});
24432445
});
2446+
} else {
2447+
resolve(response.config);
24442448
}
24452449
});
24462450
});

0 commit comments

Comments
 (0)