From c91fe0bcfef61b912d52df6766b846f92267562c Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Mon, 13 Jul 2015 00:09:22 -0500 Subject: [PATCH] Fix handling too many teams in Team Arena UI --- code/ui/ui_main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/code/ui/ui_main.c b/code/ui/ui_main.c index c8d5cf26..a33371d6 100644 --- a/code/ui/ui_main.c +++ b/code/ui/ui_main.c @@ -4567,6 +4567,11 @@ static qboolean Team_Parse(char **p) { } if (token[0] == '{') { + if (uiInfo.teamCount == MAX_TEAMS) { + uiInfo.teamCount--; + Com_Printf("Too many teams, last team replaced!\n"); + } + // seven tokens per line, team name and icon, and 5 team member names if (!String_Parse(p, &uiInfo.teamList[uiInfo.teamCount].teamName) || !String_Parse(p, &tempStr)) { return qfalse; @@ -4588,11 +4593,8 @@ static qboolean Team_Parse(char **p) { } Com_Printf("Loaded team %s with team icon %s.\n", uiInfo.teamList[uiInfo.teamCount].teamName, tempStr); - if (uiInfo.teamCount < MAX_TEAMS) { - uiInfo.teamCount++; - } else { - Com_Printf("Too many teams, last team replaced!\n"); - } + uiInfo.teamCount++; + token = COM_ParseExt(p, qtrue); if (token[0] != '}') { return qfalse;