Skip to content

Commit

Permalink
fix: topic list crashes if no topics are available (#869)
Browse files Browse the repository at this point in the history
This is due to the function expecting an object unpackable to 2
iterables, but an empty iterable is returned if no topics are available.
This happens only when using glob, which might have been the reason why
this bug was not caught earlier.
  • Loading branch information
SubaruArai authored Sep 26, 2023
1 parent 677733f commit d863a87
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions rosapi/src/rosapi/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,13 @@ def get_topics_and_types(topics_glob):

# Add topics with unknown type messages.
unknown_type = topics.difference([x for x, _ in topic_types])
return zip(* topic_types + [[x,''] for x in unknown_type])
topic_types.extend([[x, ''] for x in unknown_type])
if topic_types:
return zip(*topic_types)
else:
return [], []
except:
return []
return [], []


def get_topics_for_type(type, topics_glob):
Expand Down

0 comments on commit d863a87

Please sign in to comment.