From fd021f065a4f160ad022b2fb6d88b4c977fd8b7b Mon Sep 17 00:00:00 2001 From: AMZN-Olex <5432499+AMZN-Olex@users.noreply.github.com> Date: Tue, 22 Jun 2021 10:17:28 -0400 Subject: [PATCH] Fixes to codegen to avoid nullptr access during disconnects --- .../Code/Source/AutoGen/AutoComponent_Source.jinja | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja b/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja index 92ad524711..56fa769517 100644 --- a/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja +++ b/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja @@ -1673,12 +1673,18 @@ namespace {{ Component.attrib['Namespace'] }} void {{ ComponentBaseName }}::ActivateController(Multiplayer::EntityIsMigrating entityIsMigrating) { - m_controller.get()->Activate(entityIsMigrating); + if (m_controller) + { + m_controller->Activate(entityIsMigrating); + } } void {{ ComponentBaseName }}::DeactivateController(Multiplayer::EntityIsMigrating entityIsMigrating) { - m_controller.get()->Deactivate(entityIsMigrating); + if (m_controller) + { + m_controller->Deactivate(entityIsMigrating); + } } void {{ ComponentBaseName }}::NetworkAttach(Multiplayer::NetBindComponent* netBindComponent, Multiplayer::ReplicationRecord& currentEntityRecord, Multiplayer::ReplicationRecord& predictableEntityRecord)