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:
authorBastien Montagne <montagne29@wanadoo.fr>2016-09-08 11:24:56 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-09-14 11:26:19 +0300
commitfaec666bbea46e5a5e2ae0568ff5c6aea17696a0 (patch)
tree0ccf1195f89e11677d6985ffb732c1655ab5b1dd
parent320d601e012780fdedc1866cf7658a9a6feb1d66 (diff)
Fix T49283: Crash in BKE_ptcache_make_particle_key.
This is really hack-fix actually, not sure why `get_pointcache_keys_for_time()` seems to assume it will always find key for given part index at least for current frame, and whether this assumption is wrong or whether bug happens elsewhere... Anyway, this is to be wiped out in 2.8, so no point loosing too much time on it, for now merely returning unchanged (i.e. zero'ed) ParticleKeys in case index2 is invalid. Won't hurt anyway, even if this did not crash in release builds, would be returning giberish values.
-rw-r--r--source/blender/blenkernel/intern/particle.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 907521c9677..3eb575105ea 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -885,6 +885,9 @@ static void get_pointcache_keys_for_time(Object *UNUSED(ob), PointCache *cache,
index2 = BKE_ptcache_mem_index_find(pm, index);
index1 = BKE_ptcache_mem_index_find(pm->prev, index);
+ if (index2 < 0) {
+ return;
+ }
BKE_ptcache_make_particle_key(key2, index2, pm->data, (float)pm->frame);
if (index1 < 0)
@@ -895,6 +898,9 @@ static void get_pointcache_keys_for_time(Object *UNUSED(ob), PointCache *cache,
else if (cache->mem_cache.first) {
pm = cache->mem_cache.first;
index2 = BKE_ptcache_mem_index_find(pm, index);
+ if (index2 < 0) {
+ return;
+ }
BKE_ptcache_make_particle_key(key2, index2, pm->data, (float)pm->frame);
copy_particle_key(key1, key2, 1);
}