Fix crash when prefab root object failed to deserialize
This commit is contained in:
@@ -721,8 +721,15 @@ void SceneObjectsFactory::SynchronizePrefabInstances(Context& context, PrefabSyn
|
|||||||
if (instance.FixRootParent && JsonTools::GetGuidIfValid(prefabStartParentId, prefabStartData, "ParentID"))
|
if (instance.FixRootParent && JsonTools::GetGuidIfValid(prefabStartParentId, prefabStartData, "ParentID"))
|
||||||
{
|
{
|
||||||
auto* root = data.SceneObjects[instance.RootIndex];
|
auto* root = data.SceneObjects[instance.RootIndex];
|
||||||
const auto rootParent = Scripting::FindObject<Actor>(prefabStartParentId);
|
if (root)
|
||||||
root->SetParent(rootParent, false);
|
{
|
||||||
|
const auto rootParent = Scripting::FindObject<Actor>(prefabStartParentId);
|
||||||
|
root->SetParent(rootParent, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG(Warning, "Missing root actor at index {} for prefab instance at actor {} ({})", instance.RootIndex, instance.RootId, instance.Prefab->ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user