mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2024-11-10 06:31:47 +00:00
Fix possible bot goal state NULL pointer dereference
This commit is contained in:
parent
9a0ee67e04
commit
e9e11f1605
1 changed files with 5 additions and 2 deletions
|
@ -227,6 +227,9 @@ void BotInterbreedGoalFuzzyLogic(int parent1, int parent2, int child)
|
||||||
p2 = BotGoalStateFromHandle(parent2);
|
p2 = BotGoalStateFromHandle(parent2);
|
||||||
c = BotGoalStateFromHandle(child);
|
c = BotGoalStateFromHandle(child);
|
||||||
|
|
||||||
|
if (!p1 || !p2 || !c)
|
||||||
|
return;
|
||||||
|
|
||||||
InterbreedWeightConfigs(p1->itemweightconfig, p2->itemweightconfig,
|
InterbreedWeightConfigs(p1->itemweightconfig, p2->itemweightconfig,
|
||||||
c->itemweightconfig);
|
c->itemweightconfig);
|
||||||
} //end of the function BotInterbreedingGoalFuzzyLogic
|
} //end of the function BotInterbreedingGoalFuzzyLogic
|
||||||
|
@ -241,7 +244,7 @@ void BotSaveGoalFuzzyLogic(int goalstate, char *filename)
|
||||||
//bot_goalstate_t *gs;
|
//bot_goalstate_t *gs;
|
||||||
|
|
||||||
//gs = BotGoalStateFromHandle(goalstate);
|
//gs = BotGoalStateFromHandle(goalstate);
|
||||||
|
//if (!gs) return;
|
||||||
//WriteWeightConfig(filename, gs->itemweightconfig);
|
//WriteWeightConfig(filename, gs->itemweightconfig);
|
||||||
} //end of the function BotSaveGoalFuzzyLogic
|
} //end of the function BotSaveGoalFuzzyLogic
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
@ -255,7 +258,7 @@ void BotMutateGoalFuzzyLogic(int goalstate, float range)
|
||||||
bot_goalstate_t *gs;
|
bot_goalstate_t *gs;
|
||||||
|
|
||||||
gs = BotGoalStateFromHandle(goalstate);
|
gs = BotGoalStateFromHandle(goalstate);
|
||||||
|
if (!gs) return;
|
||||||
EvolveWeightConfig(gs->itemweightconfig);
|
EvolveWeightConfig(gs->itemweightconfig);
|
||||||
} //end of the function BotMutateGoalFuzzyLogic
|
} //end of the function BotMutateGoalFuzzyLogic
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
Loading…
Reference in a new issue