Skip to content

Commit bdb778a

Browse files
committed
fix TopicSubscriber
1 parent 13682b4 commit bdb778a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

behaviortree_ros2/include/behaviortree_ros2/bt_topic_sub_node.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -296,14 +296,14 @@ template<class T> inline
296296
std::string topic_name;
297297
getInput("topic_name", topic_name);
298298

299-
if(!sub_instance_)
299+
if(!topic_name.empty() && topic_name != "__default__placeholder__" && topic_name != topic_name_)
300300
{
301-
createSubscriber(topic_name);
301+
sub_instance_.reset();
302302
}
303-
else if(topic_name_ != topic_name)
303+
304+
if(!sub_instance_)
304305
{
305-
sub_instance_.reset();
306-
createSubscriber(topic_name);
306+
createSubscriber(topic_name);
307307
}
308308

309309
auto CheckStatus = [](NodeStatus status)

0 commit comments

Comments
 (0)