mirror of https://github.com/vitalif/openscad
createGeometry() should never return NULL
parent
1cca6c088a
commit
defb486a64
|
@ -544,8 +544,8 @@ Geometry *PrimitiveNode::createGeometry() const
|
|||
o.vertices[2] = v2;
|
||||
o.vertices[3] = Vector2d(v1[0], v2[1]);
|
||||
p->addOutline(o);
|
||||
p->setSanitized(true);
|
||||
}
|
||||
p->setSanitized(true);
|
||||
}
|
||||
break;
|
||||
case CIRCLE: {
|
||||
|
@ -561,8 +561,8 @@ Geometry *PrimitiveNode::createGeometry() const
|
|||
o.vertices[i] = Vector2d(this->r1*cos(phi), this->r1*sin(phi));
|
||||
}
|
||||
p->addOutline(o);
|
||||
p->setSanitized(true);
|
||||
}
|
||||
p->setSanitized(true);
|
||||
}
|
||||
break;
|
||||
case POLYGON: {
|
||||
|
@ -574,12 +574,10 @@ Geometry *PrimitiveNode::createGeometry() const
|
|||
const Value::VectorType &vec = this->points.toVector();
|
||||
for (unsigned int i=0;i<vec.size();i++) {
|
||||
const Value &val = vec[i];
|
||||
if (!val.getVec2(x, y) ||
|
||||
isinf(x) || isinf(y)) {
|
||||
if (!val.getVec2(x, y) || isinf(x) || isinf(y)) {
|
||||
PRINTB("ERROR: Unable to convert point %s at index %d to a vec2 of numbers",
|
||||
val.toString() % i);
|
||||
delete p;
|
||||
return NULL;
|
||||
return p;
|
||||
}
|
||||
outline.vertices.push_back(Vector2d(x, y));
|
||||
}
|
||||
|
@ -601,11 +599,7 @@ Geometry *PrimitiveNode::createGeometry() const
|
|||
}
|
||||
}
|
||||
|
||||
if (p->outlines().size() == 0) {
|
||||
delete p;
|
||||
g = NULL;
|
||||
}
|
||||
else {
|
||||
if (p->outlines().size() > 0) {
|
||||
p->setConvexity(convexity);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue