Skip to content

Commit

Permalink
handle node names which are null (#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk-thomas authored Mar 30, 2018
1 parent fa81d95 commit 45dcd0c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions rclcpp/src/rclcpp/node_interfaces/node_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,12 @@ NodeGraph::get_node_names() const
throw std::runtime_error(error_msg);
}

std::vector<std::string> node_names(&node_names_c.data[0],
&node_names_c.data[0 + node_names_c.size]);
std::vector<std::string> node_names(node_names_c.size);
for (size_t i = 0; i < node_names_c.size; ++i) {
if (node_names_c.data[i]) {
node_names[i] = node_names_c.data[i];
}
}
ret = rcutils_string_array_fini(&node_names_c);
if (ret != RCUTILS_RET_OK) {
// *INDENT-OFF*
Expand Down

0 comments on commit 45dcd0c

Please sign in to comment.