handle node names which are null (#435)

This commit is contained in:
Dirk Thomas 2018-03-30 10:56:06 -07:00 committed by GitHub
parent fa81d95e33
commit 45dcd0c6e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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*