fix/workaround for crash in ocean modifier when size is zero (causes invalid array index/lookups).
This commit is contained in:
@@ -426,6 +426,11 @@ static DerivedMesh *doOcean(ModifierData *md, Object *ob,
|
||||
|
||||
const float size_co_inv = 1.0f / (omd->size * omd->spatial_size);
|
||||
|
||||
/* can happen in when size is small, avoid bad array lookups later and quit now */
|
||||
if (!isfinite(size_co_inv)) {
|
||||
return derivedData;
|
||||
}
|
||||
|
||||
/* update modifier */
|
||||
if (omd->refresh & MOD_OCEAN_REFRESH_ADD)
|
||||
omd->ocean = BKE_add_ocean();
|
||||
@@ -531,7 +536,7 @@ static DerivedMesh *doOcean(ModifierData *md, Object *ob,
|
||||
}
|
||||
}
|
||||
|
||||
#undef OCEAN_CO
|
||||
#undef OCEAN_CO
|
||||
|
||||
return dm;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user