Bugfix: sculpt mode could crash using a mesh without faces.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 18 Dec 2009 17:15:58 +0000 (17:15 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 18 Dec 2009 17:15:58 +0000 (17:15 +0000)
source/blender/blenlib/intern/pbvh.c

index ff68e3b088131e015b62fd6f96e3f33e1f688064..6f33fab25717173ade4d50a9009ec07154605a56 100644 (file)
@@ -504,7 +504,8 @@ void BLI_pbvh_build_mesh(PBVH *bvh, MFace *faces, MVert *verts, int totface, int
                BB_expand(&cb, bbc->bcentroid);
        }
 
-       pbvh_build(bvh, &cb, prim_bbc, totface);
+       if(totface)
+               pbvh_build(bvh, &cb, prim_bbc, totface);
 
        MEM_freeN(prim_bbc);
        MEM_freeN(bvh->vert_bitmap);
@@ -544,7 +545,8 @@ void BLI_pbvh_build_grids(PBVH *bvh, DMGridData **grids, DMGridAdjacency *gridad
                BB_expand(&cb, bbc->bcentroid);
        }
 
-       pbvh_build(bvh, &cb, prim_bbc, totgrid);
+       if(totgrid)
+               pbvh_build(bvh, &cb, prim_bbc, totgrid);
 
        MEM_freeN(prim_bbc);
 }