Cleanup: assert the index created in rule_follow_leader is valid
Assert that the partial is part of the particle system before creating an index. This is a hint to developers that the cast is safe and using a pointer offset isn't going to cause problems. Issue raised by !111193. Co-authored-by: Loren Osborn <linux_dr>
This commit is contained in:
@@ -485,8 +485,10 @@ static bool rule_follow_leader(BoidRule *rule,
|
||||
BoidRuleFollowLeader *flbr = (BoidRuleFollowLeader *)rule;
|
||||
float vec[3] = {0.0f, 0.0f, 0.0f}, loc[3] = {0.0f, 0.0f, 0.0f};
|
||||
float mul, len;
|
||||
int n = (flbr->queue_size <= 1) ? bbd->sim->psys->totpart : flbr->queue_size;
|
||||
int i, p = pa - bbd->sim->psys->particles;
|
||||
const int n = (flbr->queue_size <= 1) ? bbd->sim->psys->totpart : flbr->queue_size;
|
||||
BLI_assert(ARRAY_HAS_ITEM(pa, bbd->sim->psys->particles, bbd->sim->psys->totpart));
|
||||
const int p = int(pa - bbd->sim->psys->particles);
|
||||
int i;
|
||||
bool ret = false;
|
||||
|
||||
if (flbr->ob) {
|
||||
|
||||
Reference in New Issue
Block a user