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:
1 parent
74aa4268b2
commit
6e340f9a5b
4 files changed
+18
-13
No files matched your search
+6
-2
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user