Skip to content

Commit

Permalink
Fix issue #2566: Prevent follow actor plugin from crashing when actor…
Browse files Browse the repository at this point in the history
… is (#2577)

removed

Adds a simple check that the entities are still in the scene.

Signed-off-by: Arjo Chakravarty <[email protected]>
  • Loading branch information
arjo129 authored Sep 3, 2024
1 parent 7b3d182 commit faebf12
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/systems/follow_actor/FollowActor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ void FollowActor::PreUpdate(const UpdateInfo &_info,
this->dataPtr->lastUpdate = _info.simTime;

// Is there a follow target?
if (this->dataPtr->targetEntity == kNullEntity)
if (this->dataPtr->targetEntity == kNullEntity ||
_ecm.HasEntity(this->dataPtr->targetEntity) ||
_ecm.HasEntity(this->dataPtr->actorEntity))
return;

// Current world pose
Expand Down

0 comments on commit faebf12

Please sign in to comment.