diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-07-23 01:02:45 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-07-23 01:02:45 +0400 |
commit | 0682ade250a55158b4b5cffbea4de994e373c459 (patch) | |
tree | 8efc0c4b8f70014d1650b7d2f2ca5c8043d4bd15 /source/blender/modifiers | |
parent | 003df3d2de3aeafe5bcfb3fcbf51938f486f892e (diff) |
fix/workaround for crash in ocean modifier when size is zero (causes invalid array index/lookups).
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_ocean.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index 538415b0f87..ecd116a9896 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -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; } |