From 63ed9eaaa6bba3061b0d658235337a56525e0506 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Thu, 21 Sep 2023 12:13:01 -0500 Subject: [PATCH] Fix crash when starting Topic Viewer (#574) Signed-off-by: Addisu Z. Taddese --- src/plugins/topic_viewer/TopicViewer.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/topic_viewer/TopicViewer.cc b/src/plugins/topic_viewer/TopicViewer.cc index 7e95a79c1..9fce9866a 100644 --- a/src/plugins/topic_viewer/TopicViewer.cc +++ b/src/plugins/topic_viewer/TopicViewer.cc @@ -202,8 +202,11 @@ void TopicViewerPrivate::CreateModel() std::vector publishers; std::vector subscribers; this->node.TopicInfo(topics[i], publishers, subscribers); - std::string msgType = publishers[0].MsgTypeName(); - this->AddTopic(topics[i], msgType); + if (!publishers.empty()) + { + std::string msgType = publishers[0].MsgTypeName(); + this->AddTopic(topics[i], msgType); + } } }