瀏覽代碼

Added nullcheck

Signed-off-by: pereslav <[email protected]>
pereslav 4 年之前
父節點
當前提交
f6fe6b5dac
共有 1 個文件被更改,包括 9 次插入6 次删除
  1. 9 6
      Gem/Code/Source/Components/CharacterComponent.cpp

+ 9 - 6
Gem/Code/Source/Components/CharacterComponent.cpp

@@ -52,13 +52,16 @@ namespace MultiplayerSample
             if (isKinematic)
             {
                 const PhysX::ActorData* actorData = PhysX::Utils::GetUserData(rigidDynamic);
-                const AZ::EntityId entityId = actorData->GetEntityId();
-
-                if (NetworkRigidBodyRequestBus::FindFirstHandler(entityId) != nullptr)
+                if (actorData)
                 {
-                    // Network rigid bodies are kinematic on the client but dynamic on the server,
-                    // hence filtering treats these actors as dynamic to support client prediction and avoid desyncs
-                    isKinematic = false;
+                    const AZ::EntityId entityId = actorData->GetEntityId();
+
+                    if (NetworkRigidBodyRequestBus::FindFirstHandler(entityId) != nullptr)
+                    {
+                        // Network rigid bodies are kinematic on the client but dynamic on the server,
+                        // hence filtering treats these actors as dynamic to support client prediction and avoid desyncs
+                        isKinematic = false;
+                    }
                 }
             }