From 601fe7b6435f462a4ce3be80cb7b53b940018ca8 Mon Sep 17 00:00:00 2001 From: bartek-kc Date: Tue, 8 Nov 2022 20:11:56 +0100 Subject: [PATCH 1/2] Fixing conditional jump based on uninitialized optional values Signed-off-by: bartek-kc --- topic_tools/src/tool_base_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/topic_tools/src/tool_base_node.cpp b/topic_tools/src/tool_base_node.cpp index 9ee8527..e1e4aef 100644 --- a/topic_tools/src/tool_base_node.cpp +++ b/topic_tools/src/tool_base_node.cpp @@ -31,7 +31,7 @@ void ToolBaseNode::make_subscribe_unsubscribe_decisions() { if (auto source_info = try_discover_source()) { // always relay same topic type and QoS profile as the first available source - if (*topic_type_ != source_info->first || *qos_profile_ != source_info->second || !pub_) { + if (!topic_type_ || !qos_profile_ || *topic_type_ != source_info->first || *qos_profile_ != source_info->second || !pub_) { topic_type_ = source_info->first; qos_profile_ = source_info->second; pub_ = this->create_generic_publisher(output_topic_, *topic_type_, *qos_profile_); From 20c0191c39e88b9ccbf99d66af072b164fdfee56 Mon Sep 17 00:00:00 2001 From: bartek-kc Date: Wed, 9 Nov 2022 12:50:40 +0100 Subject: [PATCH 2/2] Fixing Uncrustify and cpplint warnings Signed-off-by: bartek-kc --- topic_tools/src/tool_base_node.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/topic_tools/src/tool_base_node.cpp b/topic_tools/src/tool_base_node.cpp index e1e4aef..4f2eab0 100644 --- a/topic_tools/src/tool_base_node.cpp +++ b/topic_tools/src/tool_base_node.cpp @@ -31,7 +31,9 @@ void ToolBaseNode::make_subscribe_unsubscribe_decisions() { if (auto source_info = try_discover_source()) { // always relay same topic type and QoS profile as the first available source - if (!topic_type_ || !qos_profile_ || *topic_type_ != source_info->first || *qos_profile_ != source_info->second || !pub_) { + if (!topic_type_ || !qos_profile_ || *topic_type_ != source_info->first || + *qos_profile_ != source_info->second || !pub_) + { topic_type_ = source_info->first; qos_profile_ = source_info->second; pub_ = this->create_generic_publisher(output_topic_, *topic_type_, *qos_profile_);