Skip to content

Commit

Permalink
Only get parameter if it is set
Browse files Browse the repository at this point in the history
  • Loading branch information
sloretz committed Jun 8, 2018
1 parent 4931f3f commit d3ed33a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions rclcpp/src/rclcpp/node_interfaces/node_parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,12 @@ NodeParameters::get_parameter(
{
std::lock_guard<std::mutex> lock(mutex_);

if (parameters_.count(name)) {
parameter = {name, parameters_.at(name).value};
auto param_iter = parameters_.find(name);
if (
parameters_.end() != param_iter &&
param_iter->second.value.get_type() != rclcpp::ParameterType::PARAMETER_NOT_SET)
{
parameter = {name, param_iter->second.value};
return true;
} else {
return false;
Expand Down

0 comments on commit d3ed33a

Please sign in to comment.