Skip to content

Commit

Permalink
Fix nullptr issue
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Brawner <[email protected]>
  • Loading branch information
brawner committed Feb 9, 2021
1 parent 500020f commit f9b456e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/systems/user_commands/UserCommands.cc
Original file line number Diff line number Diff line change
Expand Up @@ -751,8 +751,11 @@ const math::Pose3d &PoseCommand::ChildToTopLevelAncestorTransform(
if (cached_it != _cachedPoses->end())
return cached_it->second;

const auto childLocalPose =
const auto childLocalPoseComp =
this->iface->ecm->Component<components::Pose>(_child);
const math::Pose3d &childLocalPose =
(nullptr == childLocalPoseComp) ?
math::Pose3d::Zero : childLocalPoseComp->Data();

// Recur upwards
const Entity directParent = this->iface->ecm->ParentEntity(_child);
Expand All @@ -761,7 +764,7 @@ const math::Pose3d &PoseCommand::ChildToTopLevelAncestorTransform(
directParent, _topLevelAncestor, _cachedPoses);

const auto childToTopLevelPoseTransform =
parentToTopLevelPoseTransform * childLocalPose->Data();
parentToTopLevelPoseTransform * childLocalPose;

// Place into cache and return
const auto[inserted_it, was_inserted] =
Expand Down

0 comments on commit f9b456e

Please sign in to comment.