Fix T48415: Segfault on opening .blend in which a 'surface' force object was saved in Edit mode.

In that case, surface modifier won't run (until surface object goes back to Object mode),
and its bvhtree remains NULL.
This commit is contained in:
Bastien Montagne 2016-06-01 15:26:58 +02:00
parent 8cf8679b53
commit b1704d18a1
Notes: blender-bot 2023-02-14 07:53:51 +01:00
Referenced by issue #48415, EXCEPTION_ACCESS_VIOLATION crash on opening file
1 changed files with 3 additions and 1 deletions

View File

@ -566,7 +566,9 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
float cfra = eff->scene->r.cfra;
int ret = 0;
if (eff->pd && eff->pd->shape==PFIELD_SHAPE_SURFACE && eff->surmd) {
/* In case surface object is in Edit mode when loading the .blend, surface modifier is never executed
* and bvhtree never built, see T48415. */
if (eff->pd && eff->pd->shape==PFIELD_SHAPE_SURFACE && eff->surmd && eff->surmd->bvhtree) {
/* closest point in the object surface is an effector */
float vec[3];