Prevent errors during cleaning of connections/identifiers in device registry (#144558)

This commit is contained in:
starkillerOG 2025-05-09 14:50:00 +02:00 committed by Franck Nijhof
parent 181eca6c82
commit f392e0c1c7
No known key found for this signature in database
GPG Key ID: AB33ADACE7101952

View File

@ -575,9 +575,11 @@ class DeviceRegistryItems[_EntryTypeT: (DeviceEntry, DeletedDeviceEntry)](
"""Unindex an entry."""
old_entry = self.data[key]
for connection in old_entry.connections:
del self._connections[connection]
if connection in self._connections:
del self._connections[connection]
for identifier in old_entry.identifiers:
del self._identifiers[identifier]
if identifier in self._identifiers:
del self._identifiers[identifier]
def get_entry(
self,