]> git.deb.at Git - rhonda/impostor.git/commitdiff
Clamp taskCount to the length of the task list
authorminiduikboot <mini@duikbo.at>
Sat, 8 Jan 2022 16:38:22 +0000 (17:38 +0100)
committerminiduikboot <mini@duikbo.at>
Sat, 8 Jan 2022 16:42:05 +0000 (17:42 +0100)
New tasks cannot be created at this point because we don't know the
underlying tasks. So we try to maintain the tasks we do know of.

src/Impostor.Server/Net/Inner/Objects/InnerPlayerInfo.cs

index 0b1abcefa0d763fe7560e7dbee551dde0c68cd6d..71bd53dc0bb27a00636c3499298a84fa985630a7 100644 (file)
@@ -85,9 +85,9 @@ namespace Impostor.Server.Net.Inner.Objects
 
             var taskCount = reader.ReadByte();
 
-            if (Tasks.Count != taskCount)
+            if (Tasks.Count < taskCount)
             {
-                Tasks = new List<InnerGameData.TaskInfo>(taskCount);
+                taskCount = (byte)Tasks.Count;
             }
 
             for (var i = 0; i < taskCount; i++)