diff --git a/Source/Engine/Level/Prefabs/Prefab.Apply.cpp b/Source/Engine/Level/Prefabs/Prefab.Apply.cpp index b960ce7cf..a0c20a221 100644 --- a/Source/Engine/Level/Prefabs/Prefab.Apply.cpp +++ b/Source/Engine/Level/Prefabs/Prefab.Apply.cpp @@ -974,7 +974,7 @@ bool Prefab::ApplyAllInternal(Actor* targetActor, bool linkTargetActorObjectToPr { // When changing prefab root the target actor is a new root so try to find it in the objects int32 targetActorIdx = oldObjectsIds.Find(targetActor->GetPrefabObjectID()); - if (targetActorIdx > 0 && dynamic_cast(sceneObjects.Value->At(targetActorIdx))) + if (targetActorIdx > 0 && targetActorIdx < sceneObjects.Value->Count() && dynamic_cast(sceneObjects.Value->At(targetActorIdx))) { root = dynamic_cast(sceneObjects.Value->At(targetActorIdx)); }