Skip to content

Commit

Permalink
check for nullptr before publishing event (#714)
Browse files Browse the repository at this point in the history
Signed-off-by: alberto <asoragna@irobot.com>
  • Loading branch information
alsora authored and dirk-thomas committed May 2, 2019
1 parent 59d59b0 commit 7ed130c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rclcpp/src/rclcpp/node_interfaces/node_parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 7ed130c

Please sign in to comment.