From 15fbe97504ccbd5d61bc3937e92c69eff348fcd1 Mon Sep 17 00:00:00 2001 From: kberg-amzn Date: Thu, 21 Oct 2021 17:12:08 -0700 Subject: [PATCH] Adding a guard for this, since tests attempt to apply autonomy to an invalid entity Signed-off-by: kberg-amzn --- Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp index f628119aef..fdd7602f71 100644 --- a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp +++ b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp @@ -1148,6 +1148,12 @@ namespace Multiplayer void MultiplayerSystemComponent::EnableAutonomousControl(NetworkEntityHandle entityHandle, AzNetworking::ConnectionId connectionId) { + if (!entityHandle.Exists()) + { + AZLOG_WARN("Attempting to enable autonomous control for an invalid entity"); + return; + } + entityHandle.GetNetBindComponent()->SetOwningConnectionId(connectionId); if (connectionId == InvalidConnectionId) {