Fix #126434: Boid particle fight rule crash involving non-boid psys
For the boid Fight rule (and when determining friend/enemy health), we need to check if other `ParticleTarget` psys is actually boids as well (their health data is accessed -- which is only present on boid particle systems), otherwise NULL data access crashes. I know, EOL, but simple crash fixers should still get a chance to get in I think. Could also go into LTSes. Pull Request: https://projects.blender.org/blender/blender/pulls/126494
This commit is contained in:
committed by
Philipp Oeser
parent
6d93bf6b44
commit
0d4e2ea40d
@@ -705,7 +705,7 @@ static bool rule_fight(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Part
|
||||
/* add other friendlies and calculate enemy strength and find closest enemy */
|
||||
LISTBASE_FOREACH (ParticleTarget *, pt, &bbd->sim->psys->targets) {
|
||||
ParticleSystem *epsys = psys_get_target_system(bbd->sim->ob, pt);
|
||||
if (epsys) {
|
||||
if (epsys && epsys->part->boids) {
|
||||
epars = epsys->particles;
|
||||
|
||||
neighbors = BLI_kdtree_3d_range_search(epsys->tree, pa->prev_state.co, &ptn, fbr->distance);
|
||||
|
||||
Reference in New Issue
Block a user