Skip to content

Commit

Permalink
handle node names which are null
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk-thomas committed Mar 29, 2018
1 parent 448ef38 commit fd1221d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions rclpy/src/rclpy/_rclpy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2525,8 +2525,13 @@ rclpy_get_node_names(PyObject * Py_UNUSED(self), PyObject * args)
PyObject * pynode_names = PyList_New(node_names.size);
size_t idx;
for (idx = 0; idx < node_names.size; ++idx) {
PyList_SetItem(
pynode_names, idx, PyUnicode_FromString(node_names.data[idx]));
if (node_names.data[idx]) {
PyList_SetItem(
pynode_names, idx, PyUnicode_FromString(node_names.data[idx]));
} else {
Py_INCREF(Py_None);
PyList_SetItem(pynode_names, idx, Py_None);
}
}

ret = rcutils_string_array_fini(&node_names);
Expand Down

0 comments on commit fd1221d

Please sign in to comment.