diff --git a/Assets/Mirror/Tests/Editor/NetworkServerTest.cs b/Assets/Mirror/Tests/Editor/NetworkServerTest.cs index a1892375d..abb39eb31 100644 --- a/Assets/Mirror/Tests/Editor/NetworkServerTest.cs +++ b/Assets/Mirror/Tests/Editor/NetworkServerTest.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Text.RegularExpressions; using Mirror.RemoteCalls; using NUnit.Framework; using UnityEngine; @@ -1190,5 +1191,24 @@ public void NoConnectionsTest_WithHostAndConnection() NetworkServer.connections.Clear(); NetworkServer.RemoveLocalConnection(); } + + // updating NetworkServer with a null entry in NetworkIdentity.spawned + // should log a warning. + [Test] + public void UpdateWithNullEntryInSpawned() + { + // start + NetworkServer.Listen(1); + + // add null + NetworkIdentity.spawned[42] = null; + + // update + LogAssert.Expect(LogType.Warning, new Regex("Found 'null' entry in spawned list.*")); + NetworkServer.Update(); + + // clean up + NetworkServer.Shutdown(); + } } }