diff --git a/rclcpp/src/rclcpp/node_interfaces/node_parameters.cpp b/rclcpp/src/rclcpp/node_interfaces/node_parameters.cpp index ea5e07014e..9ee2836393 100644 --- a/rclcpp/src/rclcpp/node_interfaces/node_parameters.cpp +++ b/rclcpp/src/rclcpp/node_interfaces/node_parameters.cpp @@ -291,8 +291,10 @@ NodeParameters::declare_parameter( "parameter '" + name + "' could not be set: " + result.reason); } - // Publish the event. - events_publisher_->publish(parameter_event); + // Publish if events_publisher_ is not nullptr, which may be if disabled in the constructor. + if (nullptr != events_publisher_) { + events_publisher_->publish(parameter_event); + } return parameters_.at(name).value; }