Skip to content

Commit 3671c43

Browse files
committed
Catch error case on corrupt packet
1 parent e6f7fb7 commit 3671c43

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mqttshark

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,21 +276,21 @@ def print_properties(args, mqtt):
276276
elif prop_type == "num":
277277
try:
278278
value = prop_numbers.pop(0)
279-
except AttributeError:
279+
except (AttributeError, IndexError):
280280
value = errstr
281281
elif prop_type == "string":
282282
try:
283283
value = prop_strings.pop(0)
284-
except AttributeError:
284+
except (AttributeError, IndexError):
285285
value = errstr
286286
elif prop_type == "stringpair":
287287
try:
288288
key = prop_keys.pop(0)
289-
except AttributeError:
289+
except (AttributeError, IndexError):
290290
key = errstr
291291
try:
292292
value = prop_values.pop(0)
293-
except AttributeError:
293+
except (AttributeError, IndexError):
294294
value = errstr
295295
if key is None:
296296
print(f"{name} {property_colour}{value}{ansi_reset}")

0 commit comments

Comments
 (0)