Skip to content

Commit

Permalink
Fix issue with topic info. (#566)
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Agüero <[email protected]>
  • Loading branch information
caguero authored Aug 25, 2023
1 parent 974957f commit c7c3011
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;

// 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)
{
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)
{
// remove from model
root->removeRow(i);
Expand Down

0 comments on commit c7c3011

Please sign in to comment.