Skip to content

Commit

Permalink
Fix issue with topic info.
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Agüero <[email protected]>
  • Loading branch information
caguero committed Aug 24, 2023
1 parent 974957f commit 95c5b1f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/plugins/topic_viewer/TopicViewer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -388,11 +388,19 @@ void TopicViewer::UpdateModel()
std::vector<transport::MessagePublisher> publishers;
std::vector<transport::MessagePublisher> subscribers;
this->dataPtr->node.TopicInfo(topics[i], publishers, subscribers);

if (publishers.empty())
continue;

Check warning on line 393 in src/plugins/topic_viewer/TopicViewer.cc

View check run for this annotation

Codecov / codecov/patch

src/plugins/topic_viewer/TopicViewer.cc#L392-L393

Added lines #L392 - L393 were not covered by tests

// ToDo: Go over all the publishers and also consider subscribers.
// Review the way we're using "topicsToRemove" as the logic doesn't look
// very clear to me.

std::string msgType = publishers[0].MsgTypeName();

// skip the matched topics
if (this->dataPtr->currentTopics.count(topics[i]) &&
this->dataPtr->currentTopics[topics[i]] == msgType)
this->dataPtr->currentTopics[topics[i]] == msgType)

Check warning on line 403 in src/plugins/topic_viewer/TopicViewer.cc

View check run for this annotation

Codecov / codecov/patch

src/plugins/topic_viewer/TopicViewer.cc#L403

Added line #L403 was not covered by tests
{
topicsToRemove.erase(topics[i]);
continue;
Expand All @@ -413,7 +421,7 @@ void TopicViewer::UpdateModel()
auto child = root->child(i);

if (child->data(NAME_ROLE).toString().toStdString() == topic.first &&
child->data(TYPE_ROLE).toString().toStdString() == topic.second)
child->data(TYPE_ROLE).toString().toStdString() == topic.second)

Check warning on line 424 in src/plugins/topic_viewer/TopicViewer.cc

View check run for this annotation

Codecov / codecov/patch

src/plugins/topic_viewer/TopicViewer.cc#L424

Added line #L424 was not covered by tests
{
// remove from model
root->removeRow(i);
Expand Down

0 comments on commit 95c5b1f

Please sign in to comment.