device: check for uninitialized protocol when pinging

This commit is contained in:
Peter F. Patel-Schneider 2021-12-21 11:02:37 -05:00
parent b86af20f67
commit d5a6ef058a
1 changed files with 2 additions and 3 deletions

View File

@ -397,9 +397,8 @@ class Device:
def ping(self): def ping(self):
"""Checks if the device is online, returns True of False""" """Checks if the device is online, returns True of False"""
protocol = _base.ping( long = self.bluetooth or self._protocol is not None and self._protocol >= 2.0
self.handle or self.receiver.handle, self.number, long_message=self.bluetooth or self._protocol >= 2.0 protocol = _base.ping(self.handle or self.receiver.handle, self.number, long_message=long)
)
self.online = protocol is not None self.online = protocol is not None
if protocol: if protocol:
self._protocol = protocol self._protocol = protocol