Fix T93338: Curve Guide force field crash

Caused by {rBcf2baa585cc8}.

For Curve Guide force fields to work, the `Path Animation` option has to
be enabled. With it disabled, we are lacking the necessary
`anim_path_accum_length` data initialized [done by
`BKE_anim_path_calc_data`] which `BKE_where_on_path` relies on since
above commit.

Now just check for this before using it - and return early otherwise.
Prior to said commit, `BKE_where_on_path` would equally return early
with a similar message, so that is expected behavior here.

Maniphest Tasks: T93338

Differential Revision: https://developer.blender.org/D13371
This commit is contained in:
Philipp Oeser 2021-11-25 13:45:32 +01:00
parent 845716e600
commit ffddf9e5c9
Notes: blender-bot 2023-02-14 06:55:40 +01:00
Referenced by issue #88449: Blender LTS: Maintenance Task 2.93
Referenced by issue #88449, Blender LTS: Maintenance Task 2.93
Referenced by issue #93338, Curve Guide force field causes crash
1 changed files with 4 additions and 0 deletions

View File

@ -254,6 +254,10 @@ bool BKE_where_on_path(const Object *ob,
CLOG_WARN(&LOG, "No curve cache!");
return false;
}
if (ob->runtime.curve_cache->anim_path_accum_length == NULL) {
CLOG_WARN(&LOG, "No anim path!");
return false;
}
/* We only use the first curve. */
BevList *bl = ob->runtime.curve_cache->bev.first;
if (bl == NULL || !bl->nr) {