From 851323e1128596b61bc1a924aafa8cb77920ea54 Mon Sep 17 00:00:00 2001 From: karlberg Date: Sat, 8 May 2021 10:05:16 -0700 Subject: [PATCH] One more test crash fix due to nullptr component application --- .../AzFramework/Components/TransformComponent.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.cpp b/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.cpp index fb2d3d35bf..5605fe567c 100644 --- a/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.cpp +++ b/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.cpp @@ -695,8 +695,8 @@ namespace AzFramework parentId = handler->GetParentId(); } #endif - - AZ::Entity* parentEntity = AZ::Interface::Get()->FindEntity(parentEntityId); + AZ::ComponentApplicationRequests* componentApplication = AZ::Interface::Get(); + AZ::Entity* parentEntity = (componentApplication != nullptr) ? componentApplication->FindEntity(parentEntityId) : nullptr; AZ_Assert(parentEntity, "We expect to have a parent entity associated with the provided parent's entity Id."); if (parentEntity) { @@ -745,7 +745,8 @@ namespace AzFramework m_parentId = parentId; if (m_parentId.IsValid()) { - AZ::Entity* parentEntity = AZ::Interface::Get()->FindEntity(m_parentId); + AZ::ComponentApplicationRequests* componentApplication = AZ::Interface::Get(); + AZ::Entity* parentEntity = (componentApplication != nullptr) ? componentApplication->FindEntity(m_parentId) : nullptr; m_parentActive = parentEntity && (parentEntity->GetState() == AZ::Entity::State::Active); m_onNewParentKeepWorldTM = isKeepWorldTM;