Skip to content

Commit

Permalink
Fix returning invalid namespace if sub_namespace is empty
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Hofstaetter <markus.hofstaetter@ait.ac.at>
  • Loading branch information
devrite committed May 5, 2021
1 parent 1fc2d58 commit 171316c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rclcpp/src/rclcpp/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ create_effective_namespace(const std::string & node_namespace, const std::string
// and do not need trimming of `/` and other things, as they were validated
// in other functions already.

if (node_namespace.back() == '/') {
//A node may not have a sub_namespace if it is no sub_node. In this case,
//just return the original namespace
if(sub_namespace.empty()) {
return node_namespace;
} else if (node_namespace.back() == '/') {
// this is the special case where node_namespace is just `/`
return node_namespace + sub_namespace;
} else {
Expand Down

0 comments on commit 171316c

Please sign in to comment.