Skip to content

Commit

Permalink
Fix crash
Browse files Browse the repository at this point in the history
Signed-off-by: Alejandro Hernández Cordero <[email protected]>
  • Loading branch information
ahcorde committed Dec 12, 2023
1 parent 64149f5 commit 3252ccd
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@ class SimpleSubscriberPlugin : public SubscriberPlugin
rcl_interfaces::msg::ParameterDescriptor param_descriptor = parameter_descriptor;
param_descriptor.name = param_name;

impl_->node_->template declare_parameter<T>(param_name, value, param_descriptor);
try {
impl_->node_->template declare_parameter<T>(param_name, value, param_descriptor);
} catch (const rclcpp::exceptions::ParameterAlreadyDeclaredException &) {
RCLCPP_DEBUG(impl_->node_->get_logger(), "%s was previously declared", param_descriptor.name.c_str());
}

return true;
}
return false;
Expand Down

0 comments on commit 3252ccd

Please sign in to comment.