Skip to content

Commit

Permalink
Merge pull request #719 from elandini84/fix_segfault_yarprobotstatepu…
Browse files Browse the repository at this point in the history
…blisher_onread

bug-fix: JointIndex validity check
  • Loading branch information
traversaro authored Aug 5, 2020
2 parents ec2eb13 + 38ca326 commit 897291b
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,9 @@ void YARPRobotStatePublisherModule::onRead(yarp::rosmsg::sensor_msgs::JointState
{
jntIndex = model.getJointIndex(v.name[i]);

if (!(model.getJoint(jntIndex)->getNrOfDOFs()) || jntIndex == iDynTree::JOINT_INVALID_INDEX)
if ( jntIndex == iDynTree::JOINT_INVALID_INDEX)
continue;
if (!(model.getJoint(jntIndex)->getNrOfDOFs()))
continue;

m_jointPos(model.getJoint(jntIndex)->getDOFsOffset()) = v.position[i];
Expand Down

0 comments on commit 897291b

Please sign in to comment.