diff --git a/blueman/bluez/errors.py b/blueman/bluez/errors.py index 6f31b1c77..dfe3200a1 100644 --- a/blueman/bluez/errors.py +++ b/blueman/bluez/errors.py @@ -85,6 +85,10 @@ class DBusUnsupportedMajorClassError(BluezDBusException): pass +class DBusUnknownObjectError(BluezDBusException): + pass + + class DBusServiceUnknownError(BluezDBusException): pass @@ -121,6 +125,7 @@ class BluezUnavailableAgentMethodError(BluezDBusException): 'org.bluez.Error.AuthenticationCanceled': DBusAuthenticationCanceledError, 'org.bluez.serial.Error.NotSupported': DBusNotSupportedError, 'org.bluez.Error.UnsupportedMajorClass': DBusUnsupportedMajorClassError, + 'org.freedesktop.DBus.Error.UnknownObject': DBusUnknownObjectError, 'org.freedesktop.DBus.Error.ServiceUnknown': DBusServiceUnknownError} diff --git a/blueman/plugins/applet/RecentConns.py b/blueman/plugins/applet/RecentConns.py index 1afac3494..33ca01f40 100644 --- a/blueman/plugins/applet/RecentConns.py +++ b/blueman/plugins/applet/RecentConns.py @@ -7,7 +7,7 @@ from blueman.bluemantyping import ObjectPath, BtAddress from blueman.bluez.Device import Device -from blueman.bluez.errors import DBusNoSuchAdapterError +from blueman.bluez.errors import DBusNoSuchAdapterError, DBusUnknownObjectError from blueman.gui.Notification import Notification from blueman.Sdp import ServiceUUID from blueman.plugins.AppletPlugin import AppletPlugin @@ -200,7 +200,11 @@ def _get_device_path(self, adapter_path: ObjectPath, address: BtAddress) -> Opti except DBusNoSuchAdapterError: return None - device = self.parent.Manager.find_device(address, adapter.get_object_path()) + try: + device = self.parent.Manager.find_device(address, adapter.get_object_path()) + except DBusUnknownObjectError: + return None + return device.get_object_path() if device is not None else None def _get_items(self) -> List["Item"]: