File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff 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 } ) ;
You can’t perform that action at this time.
0 commit comments