]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/main.qc
Don't attempt to network more than the maximum number of shown spectators, fixes...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / main.qc
index 25403017b352b30a3239f946312280e52e1e3bc7..c2c9ee8a2f4e6c717a1dd38b653f1a5d035a2d23 100644 (file)
@@ -474,12 +474,19 @@ NET_HANDLE(ENT_CLIENT_CLIENTDATA, bool isnew)
                for(i = 0; i < MAX_SPECTATORS; ++i)
                        spectatorlist[i] = 0; // reset list first
 
-               for(i = 0; i < num_spectators; ++i)
+               int limit = min(num_spectators, MAX_SPECTATORS);
+               for(i = 0; i < limit; ++i)
                {
                        slot = ReadByte();
                        spectatorlist[i] = slot - 1;
                }
        }
+       else
+       {
+               for(int j = 0; j < MAX_SPECTATORS; ++j)
+                       spectatorlist[j] = 0; // reset list if showspectators has been turned off
+               num_spectators = 0;
+       }
 
        return = true;