]> 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 dd3b62b1d0998e36475a47133b992ebc91a1edfa..c2c9ee8a2f4e6c717a1dd38b653f1a5d035a2d23 100644 (file)
@@ -1,6 +1,5 @@
 #include "main.qh"
 
-#include "defs.qh"
 #include <client/items/items.qh>
 #include <common/ent_cs.qh>
 #include "miscfunctions.qh"
@@ -475,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;