From a4b89a1b034452f0622fd6e596216e55b7bcaf35 Mon Sep 17 00:00:00 2001 From: Jacob Perron Date: Thu, 12 Mar 2020 11:38:13 -0700 Subject: [PATCH] Guard against null namespaces Signed-off-by: Jacob Perron --- rcl/src/rcl/graph.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rcl/src/rcl/graph.c b/rcl/src/rcl/graph.c index 756f15dbb..3e63c45dd 100644 --- a/rcl/src/rcl/graph.c +++ b/rcl/src/rcl/graph.c @@ -352,6 +352,13 @@ rcl_get_node_names( return RCL_RET_ERROR; } } + // Check that none of the node namespaces are NULL + for (size_t i = 0u; i < node_names->size; ++i) { + if (!node_namespaces->data[i]) { + RCL_SET_ERROR_MSG("NULL node namespace returned by the RMW layer"); + return RCL_RET_ERROR; + } + } return RCL_RET_OK; }