From 187c1cb789bd557d800eb02a9bba2b352e7abe36 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Mon, 24 Jan 2022 11:53:51 -0800 Subject: [PATCH] ? --- QSB/Utility/Extensions.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/QSB/Utility/Extensions.cs b/QSB/Utility/Extensions.cs index 2bdca246..b049d3f2 100644 --- a/QSB/Utility/Extensions.cs +++ b/QSB/Utility/Extensions.cs @@ -31,8 +31,16 @@ namespace QSB.Utility #region MIRROR - public static uint GetPlayerId(this NetworkConnection conn) => - conn.identity.netId; + public static uint GetPlayerId(this NetworkConnection conn) + { + if (conn == null) + { + DebugLog.ToConsole("Warning - GetPlayerId with null NetworkConnection", MessageType.Warning); + return uint.MaxValue; + } + + return conn.identity.netId; + } public static void SpawnWithServerAuthority(this GameObject go) => NetworkServer.Spawn(go, NetworkServer.localConnection);