Skip to content

Commit

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

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

Signed-off-by: Arjo Chakravarty <[email protected]>
  • Loading branch information
arjo129 committed Sep 2, 2024
1 parent a20bf25 commit 62c6f34
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 62c6f34

Please sign in to comment.