Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rmw_validate_namespace{_with_size} error handling. #386

Merged
merged 2 commits into from
Dec 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions rmw/src/validate_namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ rmw_validate_namespace(
int * validation_result,
size_t * invalid_index)
{
if (!namespace_) {
return RMW_RET_INVALID_ARGUMENT;
}
RCUTILS_CHECK_ARGUMENT_FOR_NULL(namespace_, RMW_RET_INVALID_ARGUMENT);

return rmw_validate_namespace_with_size(
namespace_, strlen(namespace_), validation_result, invalid_index);
}
Expand All @@ -43,12 +42,8 @@ rmw_validate_namespace_with_size(
int * validation_result,
size_t * invalid_index)
{
if (!namespace_) {
return RMW_RET_INVALID_ARGUMENT;
}
if (!validation_result) {
return RMW_RET_INVALID_ARGUMENT;
}
RCUTILS_CHECK_ARGUMENT_FOR_NULL(namespace_, RMW_RET_INVALID_ARGUMENT);
RCUTILS_CHECK_ARGUMENT_FOR_NULL(validation_result, RMW_RET_INVALID_ARGUMENT);

// Special case for root namepsace
if (namespace_length == 1 && namespace_[0] == '/') {
Expand Down