ble: make sure the length of the manufacturer data is at least 1
We never encounter the issue, but I bet we will
This commit is contained in:
parent
6cff3b8f79
commit
72523df3af
11
tuhi/ble.py
11
tuhi/ble.py
|
@ -136,8 +136,15 @@ class BlueZDevice(GObject.Object):
|
|||
@GObject.Property
|
||||
def vendor_id(self):
|
||||
md = self.interface.get_cached_property('ManufacturerData')
|
||||
if md is not None:
|
||||
return md.keys()[0]
|
||||
if md is None:
|
||||
return None
|
||||
|
||||
try:
|
||||
return next(iter(dict(md)))
|
||||
except StopIteration:
|
||||
# dict is empty
|
||||
pass
|
||||
|
||||
return None
|
||||
|
||||
@GObject.Property
|
||||
|
|
Loading…
Reference in New Issue