Before receiving game list from server, clear old games from list, and don't receive more than there are room for in the array.
parent
9a05862fba
commit
1b811abcea
|
@ -2608,7 +2608,7 @@ BOOL NETfindGame(void)
|
|||
&& socketReadReady(tcp_socket)
|
||||
&& (result = readNoInt(tcp_socket, &gamesavailable, sizeof(gamesavailable))))
|
||||
{
|
||||
gamesavailable = ntohl(gamesavailable);
|
||||
gamesavailable = MIN(ntohl(gamesavailable), ARRAY_SIZE(NetPlay.games));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2631,6 +2631,9 @@ BOOL NETfindGame(void)
|
|||
|
||||
debug(LOG_NET, "receiving info on %u game(s)", (unsigned int)gamesavailable);
|
||||
|
||||
// Clear old games from list.
|
||||
memset(NetPlay.games, 0x00, sizeof(NetPlay.games));
|
||||
|
||||
do
|
||||
{
|
||||
// Attempt to receive a game description structure
|
||||
|
|
Loading…
Reference in New Issue