check for nullptr before publishing event (#714)

Signed-off-by: alberto <asoragna@irobot.com>
This commit is contained in:
Alberto Soragna 2019-05-02 18:24:44 +01:00 committed by Dirk Thomas
parent 59d59b0c18
commit 7ed130cf7a

View file

@ -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;
}