diff options
author | kintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c> | 2010-06-14 19:23:38 (GMT) |
---|---|---|
committer | kintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c> | 2010-06-14 19:23:38 (GMT) |
commit | 04b5f3b96bb9715bce05201c8f295149cc72f2f6 (patch) | |
tree | c58f4595b10b074e730dc28c569a686e8fe0f900 /src | |
parent | 723f31ebaf976583f022ec3a180664b7ebb7c2fa (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/primitives.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/primitives.cc b/src/primitives.cc index 0808261..1856cbc 100644 --- a/src/primitives.cc +++ b/src/primitives.cc @@ -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)); } |