Skip to content

Commit e066ed1

Browse files
doisygGuillaume Doisy
andauthored
protect properly max_accel and max_decel (#3952)
Co-authored-by: Guillaume Doisy <guillaume@dexory.com>
1 parent 572d0f8 commit e066ed1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎nav2_velocity_smoother/src/velocity_smoother.cpp‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,9 @@ VelocitySmoother::dynamicParametersCallback(std::vector<rclcpp::Parameter> param
401401
result.successful = false;
402402
}
403403
}
404-
max_accels_ = parameter.as_double_array();
404+
if (result.successful) {
405+
max_accels_ = parameter.as_double_array();
406+
}
405407
} else if (name == "max_decel") {
406408
for (unsigned int i = 0; i != 3; i++) {
407409
if (parameter.as_double_array()[i] > 0.0) {
@@ -411,7 +413,9 @@ VelocitySmoother::dynamicParametersCallback(std::vector<rclcpp::Parameter> param
411413
result.successful = false;
412414
}
413415
}
414-
max_decels_ = parameter.as_double_array();
416+
if (result.successful) {
417+
max_decels_ = parameter.as_double_array();
418+
}
415419
} else if (name == "deadband_velocity") {
416420
deadband_velocities_ = parameter.as_double_array();
417421
}

0 commit comments

Comments
 (0)