Don't use uninitialized ps from BotAI_GetClientState

If BotAI_GetPlayerState returns qfalse, ps is untouched and in
some cases means uninitialized. So don't use it if not valid.
This commit is contained in:
Zack Middleton committed 2017-06-07 19:02:20 -05:00
1 parent 74aa4268b2
commit 6e340f9a5b
4 files changed
+18 -13

No files matched your search

+4 -2
View File
@@ -990,8 +990,10 @@ int BotAI(int client, float thinktime) {
}
//retrieve the current client state
BotAI_GetClientState( client, &bs->cur_ps );
if (!BotAI_GetClientState(client, &bs->cur_ps)) {
BotAI_Print(PRT_FATAL, "BotAI: failed to get player state for player %d\n", client);
return qfalse;
}
//retrieve any waiting server commands
while( trap_BotGetServerCommand(client, buf, sizeof(buf)) ) {
//have buf point to the command and args to the command arguments