Skip to content

Commit

Permalink
[jog_arm] fix access past end of array bug (moveit#2155)
Browse files Browse the repository at this point in the history
* [jog_arm] fix access past end of array bug
  • Loading branch information
tylerjw committed Jun 24, 2020
1 parent d2145f2 commit b39e2cc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions moveit_experimental/moveit_jog_arm/src/jog_calcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,9 @@ void JogCalcs::run(const ros::TimerEvent& timer_event)
else if (parameters_.command_out_type == "std_msgs/Float64MultiArray")
{
auto joints = moveit::util::make_shared_from_pool<std_msgs::Float64MultiArray>();
if (parameters_.publish_joint_positions)
if (parameters_.publish_joint_positions && !joint_trajectory->points.empty())
joints->data = joint_trajectory->points[0].positions;
else if (parameters_.publish_joint_velocities)
else if (parameters_.publish_joint_velocities && !joint_trajectory->points.empty())
joints->data = joint_trajectory->points[0].velocities;
outgoing_cmd_pub_.publish(joints);
}
Expand Down

0 comments on commit b39e2cc

Please sign in to comment.