From 8b4042a082b3445a98efc03f90cb26e763785f62 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 948054cd6..ffdc68917 100644 --- a/xwords4/linux/linuxmain.c +++ b/xwords4/linux/linuxmain.c @@ -2290,6 +2290,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; @@ -2298,6 +2299,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; @@ -2308,6 +2310,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;