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:
parent
74aa4268b2
commit
6e340f9a5b
4 changed files with 18 additions and 13 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue