From 9d02237f19b7e0486a16961bc0f1ffc2b98bb406 Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 16 Nov 2017 07:13:10 -0800 Subject: [PATCH] add assertion to catch too many players --- xwords4/linux/linuxmain.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xwords4/linux/linuxmain.c b/xwords4/linux/linuxmain.c index e3ff095e6..124321ea0 100644 --- a/xwords4/linux/linuxmain.c +++ b/xwords4/linux/linuxmain.c @@ -2284,6 +2284,7 @@ main( int argc, char** argv ) break; case CMD_PLAYERNAME: index = mainParams.pgi.nPlayers++; + XP_ASSERT( index < MAX_NUM_PLAYERS ); ++mainParams.nLocalPlayers; mainParams.pgi.players[index].robotIQ = 0; /* means human */ mainParams.pgi.players[index].isLocal = XP_TRUE; @@ -2292,6 +2293,7 @@ main( int argc, char** argv ) break; case CMD_REMOTEPLAYER: index = mainParams.pgi.nPlayers++; + XP_ASSERT( index < MAX_NUM_PLAYERS ); mainParams.pgi.players[index].isLocal = XP_FALSE; ++mainParams.info.serverInfo.nRemotePlayers; break; @@ -2302,6 +2304,7 @@ main( int argc, char** argv ) case CMD_ROBOTNAME: ++robotCount; index = mainParams.pgi.nPlayers++; + XP_ASSERT( index < MAX_NUM_PLAYERS ); ++mainParams.nLocalPlayers; mainParams.pgi.players[index].robotIQ = 1; /* real smart by default */ mainParams.pgi.players[index].isLocal = XP_TRUE;