Fix for bug #1065: boolean ops with meshes containing 0 faces crashed on Linux and OSX.

Check first if meshes have faces, otherwise don't do boolean op.

(see: http://projects.blender.org/tracker/index.php?func=detail&aid=1065&group_id=9&atid=125)
This commit is contained in:
Nathan Letwory
2004-04-08 18:58:32 +00:00
parent a9b1cd6a0e
commit 235c93e714

View File

@@ -64,10 +64,15 @@
#include "BLI_linklist.h"
#include "BLI_memarena.h"
#include "BIF_editmesh.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
/** check if passed mesh has faces, return zero if only edges, 1 if faces have been found */
int has_faces(Mesh *me);
/**
* Here's the vertex iterator structure used to walk through
* the blender vertex structure.
@@ -360,15 +365,23 @@ InterpFaceVertexData(
return 0;
}
int has_faces(Mesh *me)
{
MFace *mface;
int a;
mface= me->mface;
for(a=0; a<me->totface; a++, mface++) {
if(mface->v3) return 1;
}
return 0;
}
/**
* Assumes mesh is valid and forms part of a fresh
* blender object.
*/
int
NewBooleanMesh(
struct Base * base,
@@ -398,6 +411,13 @@ NewBooleanMesh(
if (me == NULL || me2 == NULL) return 0;
success = has_faces(me);
if(success==0) return 0;
success = has_faces(me2);
if(success==0) return 0;
success = 0;
switch (int_op_type) {
case 1 : op_type = e_csg_intersection; break;
case 2 : op_type = e_csg_union; break;