Skip to content

Commit 893679e

Browse files
authored
Check first parameter type and range before calling the user validation callbacks (ros2#1627)
Signed-off-by: Ivan Santiago Paunovic <[email protected]>
1 parent a62287b commit 893679e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

rclcpp/src/rclcpp/node_interfaces/node_parameters.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,14 +299,15 @@ __set_parameters_atomically_common(
299299
const OnParametersSetCallbackType & callback,
300300
bool allow_undeclared = false)
301301
{
302-
// Call the user callback to see if the new value(s) are allowed.
303-
rcl_interfaces::msg::SetParametersResult result =
304-
__call_on_parameters_set_callbacks(parameters, callback_container, callback);
302+
// Check if the value being set complies with the descriptor.
303+
rcl_interfaces::msg::SetParametersResult result = __check_parameters(
304+
parameter_infos, parameters, allow_undeclared);
305305
if (!result.successful) {
306306
return result;
307307
}
308-
// Check if the value being set complies with the descriptor.
309-
result = __check_parameters(parameter_infos, parameters, allow_undeclared);
308+
// Call the user callback to see if the new value(s) are allowed.
309+
result =
310+
__call_on_parameters_set_callbacks(parameters, callback_container, callback);
310311
if (!result.successful) {
311312
return result;
312313
}

0 commit comments

Comments
 (0)