File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
custom_components/sharepoint_photos Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -308,8 +308,15 @@ async def async_refresh_new_folder(self):
308308
309309async def async_unload_entry (hass : HomeAssistant , entry : ConfigEntry ) -> bool :
310310 """Handle removal of an entry."""
311- if unloaded := await hass .config_entries .async_unload_platforms (entry , PLATFORMS ):
312- hass .data [DOMAIN ].pop (entry .entry_id )
311+ try :
312+ unloaded = await hass .config_entries .async_unload_platforms (entry , PLATFORMS )
313+ except ValueError :
314+ # Platform never finished loading (e.g., setup failed); treat as unloaded.
315+ _LOGGER .debug ("Platform %s was never loaded; skipping unload" , PLATFORMS )
316+ unloaded = True
317+
318+ if unloaded :
319+ hass .data [DOMAIN ].pop (entry .entry_id , None )
313320
314321 return unloaded
315322
You can’t perform that action at this time.
0 commit comments