File tree 1 file changed +8
-2
lines changed
custom_components/ble_monitor/ble_parser
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -136,10 +136,16 @@ def parse_raw_data(self, data):
136
136
service_class_uuid128 = adstruct [2 :]
137
137
elif adstuct_type == 0x08 :
138
138
# AD type 'shortened local name'
139
- shortened_local_name = adstruct [2 :].decode ("utf-8" )
139
+ try :
140
+ shortened_local_name = adstruct [2 :].decode ("utf-8" )
141
+ except UnicodeDecodeError :
142
+ shortened_local_name = ""
140
143
elif adstuct_type == 0x09 :
141
144
# AD type 'complete local name'
142
- complete_local_name = adstruct [2 :].decode ("utf-8" )
145
+ try :
146
+ complete_local_name = adstruct [2 :].decode ("utf-8" )
147
+ except UnicodeDecodeError :
148
+ complete_local_name = ""
143
149
elif adstuct_type == 0x16 and adstuct_size > 4 :
144
150
# AD type 'Service Data - 16-bit UUID'
145
151
service_data_list .append (adstruct )
You can’t perform that action at this time.
0 commit comments