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
path: root/source
diff options
context:
space:
mode:
authorLukas Tönne <lukas.toenne@gmail.com>2014-05-07 09:56:47 +0400
committerLukas Tönne <lukas.toenne@gmail.com>2014-05-07 09:58:35 +0400
commit77d11a52b30f9eecbf2080e353ce59fa4db7e0e7 (patch)
tree6d1688e1ab807d8de6027791dfab685e88b1ccda /source
parent0710d9dfd17bc9dcc90ac4de2d9f652ae0714a2b (diff)
Fix T40052, Grid Particles Crash due to invalid empty mesh verts access
for bbox calculation.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/particle_system.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 0d4548969f2..d213a88f8b1 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -489,15 +489,19 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
int totvert=dm->getNumVerts(dm), from=psys->part->from;
int i, j, k, p, res=psys->part->grid_res, size[3], axis;
- mv=mvert;
-
/* find bounding box of dm */
- copy_v3_v3(min, mv->co);
- copy_v3_v3(max, mv->co);
- mv++;
-
- for (i=1; i<totvert; i++, mv++) {
- minmax_v3v3_v3(min, max, mv->co);
+ if (totvert > 0) {
+ mv=mvert;
+ copy_v3_v3(min, mv->co);
+ copy_v3_v3(max, mv->co);
+ mv++;
+ for (i = 1; i < totvert; i++, mv++) {
+ minmax_v3v3_v3(min, max, mv->co);
+ }
+ }
+ else {
+ zero_v3(min);
+ zero_v3(max);
}
sub_v3_v3v3(delta, max, min);