From ea4a898d74a90da50af6653b6a8384d03ba524c9 Mon Sep 17 00:00:00 2001 From: Gene Walters Date: Sat, 23 Oct 2021 19:30:51 -0700 Subject: [PATCH] Minor, adding some null checks Signed-off-by: Gene Walters --- .../Source/Editor/MultiplayerEditorSystemComponent.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.cpp b/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.cpp index 64e8b96e9f..7d4a58dbeb 100644 --- a/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.cpp +++ b/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.cpp @@ -52,7 +52,13 @@ namespace Multiplayer bool PyIsInGameMode() { // If the network entity manager is tracking at least 1 entity then the editor has connected and the autonomous player exists and is being replicated. - return AZ::Interface::Get()->GetEntityCount() > 0; + if (const INetworkEntityManager* networkEntityManager = AZ::Interface::Get()) + { + return networkEntityManager->GetEntityCount() > 0; + } + + AZ_Warning("MultiplayerEditorSystemComponent", false, "PyIsInGameMode returning false; no NetworkEntityManager has not been created yet."); + return false; } void PythonEditorFuncs::Reflect(AZ::ReflectContext* context)