Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-07-23 01:02:45 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-07-23 01:02:45 +0400
commit0682ade250a55158b4b5cffbea4de994e373c459 (patch)
tree8efc0c4b8f70014d1650b7d2f2ca5c8043d4bd15 /source/blender/modifiers
parent003df3d2de3aeafe5bcfb3fcbf51938f486f892e (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.c7
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;
}