get_provider() can return None when a provider is temporarily
unavailable (e.g., during reload or network issues). Both
remove_item_from_library() and add_item_to_library() call
.library_edit_supported() on the result without a None check,
causing an AttributeError that surfaces as a 500 error.
Co-authored-by: David Bishop <git@gnuconsulting.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
if not prov_mapping.in_library:
continue
provider = self.mass.get_provider(prov_mapping.provider_instance)
- if not provider.library_edit_supported(full_item.media_type):
+ if not provider or not provider.library_edit_supported(full_item.media_type):
continue
if not provider.library_sync_back_enabled(full_item.media_type):
continue
# add to provider(s) library first
for prov_mapping in full_item.provider_mappings:
provider = self.mass.get_provider(prov_mapping.provider_instance)
- if not provider.library_edit_supported(full_item.media_type):
+ if not provider or not provider.library_edit_supported(full_item.media_type):
continue
if not provider.library_sync_back_enabled(full_item.media_type):
continue