From 0d4e2ea40dfd049e9a99d7f911e673a890beb720 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Mon, 19 Aug 2024 17:01:18 +0200 Subject: [PATCH] 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 --- source/blender/blenkernel/intern/boids.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/boids.cc b/source/blender/blenkernel/intern/boids.cc index cdc3b642846..f2dc6aed8d7 100644 --- a/source/blender/blenkernel/intern/boids.cc +++ b/source/blender/blenkernel/intern/boids.cc @@ -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);