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
|
@ -108,8 +108,12 @@ int BotClientTravelTimeToGoal(int client, bot_goal_t *goal) {
|
|||
playerState_t ps;
|
||||
int areanum;
|
||||
|
||||
BotAI_GetClientState(client, &ps);
|
||||
areanum = BotPointAreaNum(ps.origin);
|
||||
if (BotAI_GetClientState(client, &ps)) {
|
||||
areanum = BotPointAreaNum(ps.origin);
|
||||
} else {
|
||||
areanum = 0;
|
||||
}
|
||||
|
||||
if (!areanum) return 1;
|
||||
return trap_AAS_AreaTravelTimeToGoalArea(areanum, ps.origin, goal->areanum, TFL_DEFAULT);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue