bugfix: Don't crash when giving 3D vectors or number to a parameter which expects 2d vectors

git-svn-id: http://svn.clifford.at/openscad/trunk@558 b57f626f-c46c-0410-a088-ec61d464b74c
stl_dim
kintel 2010-06-14 19:23:38 +00:00
parent 5244ea6a76
commit 0057a2992a
1 changed files with 7 additions and 2 deletions

View File

@ -30,6 +30,7 @@
#include "dxfdata.h"
#include "dxftess.h"
#include "builtin.h"
#include "printutils.h"
enum primitive_type_e {
CUBE,
@ -465,8 +466,12 @@ sphere_next_r2:
DxfData dd;
for (int i=0; i<points.vec.size(); i++) {
double x = points.vec[i]->vec[0]->num;
double y = points.vec[i]->vec[1]->num;
double x,y;
if (!points.vec[i]->getv2(x, y)) {
PRINTF("ERROR: Unable to convert point at index %d to a vec2 of numbers", i);
// FIXME: Return NULL and make sure this is checked by all callers?
return p;
}
dd.points.append(DxfData::Point(x, y));
}