summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c>2010-02-10 15:26:15 (GMT)
committerkintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c>2010-02-10 15:26:15 (GMT)
commit63c1154f8e434da1988dccac4101a51271083fe2 (patch)
treee174501a97325e266705cd7806b8327296851cd8
parent8038ee0406c05b1bc9c147e47a7ae8c02da6afbf (diff)
Fixed crash when using negative array indices
git-svn-id: http://svn.clifford.at/openscad/trunk@433 b57f626f-c46c-0410-a088-ec61d464b74c
-rw-r--r--doc/OpenSCAD-polygons.grafflebin4956 -> 5035 bytes
-rw-r--r--doc/OpenSCAD-polygons.pdfbin70632 -> 59223 bytes
-rw-r--r--doc/TODO.txt6
-rw-r--r--src/expr.cc2
4 files changed, 4 insertions, 4 deletions
diff --git a/doc/OpenSCAD-polygons.graffle b/doc/OpenSCAD-polygons.graffle
index c8c1a94..1dae615 100644
--- a/doc/OpenSCAD-polygons.graffle
+++ b/doc/OpenSCAD-polygons.graffle
Binary files differ
diff --git a/doc/OpenSCAD-polygons.pdf b/doc/OpenSCAD-polygons.pdf
index bf00397..150024d 100644
--- a/doc/OpenSCAD-polygons.pdf
+++ b/doc/OpenSCAD-polygons.pdf
Binary files differ
diff --git a/doc/TODO.txt b/doc/TODO.txt
index c0a25d4..3f62c80 100644
--- a/doc/TODO.txt
+++ b/doc/TODO.txt
@@ -9,7 +9,7 @@ CRASH BUGS
----------
o Broken polyhedron() entities are not correctly detected and cause CGAL segfaults
o Export STL: Exports existing CGAL model even though the current model is changed, but not CGAL rendered
-o Negative array indices causes crash: v=[0,1,2]; a=v[-1];
+
USER INTERFACE
--------------
@@ -66,7 +66,7 @@ o Computation
o Misc
- Reload and compile: Ask for confirmation if file is locally edited
(make this configurable in preferences?)
- - Save: Ask for confirmation if file has been externaly changed
+ - Save: Ask for confirmation if file has been externally changed
- Rename OpenCSG and CGAL to smth. not specific to the underlying libraries
(e.g Preview, Render)
@@ -127,7 +127,7 @@ o Refactor from MainWindow:
o C++-ify
- Use smart pointers where it makes sense (e.g. instead of homegrown refcount,
and to get memory ownership under control)
- - Use static_cast instead of C-style casts
+ - Use static_cast/dynamic_cast instead of C-style casts
o dxflinextrude and dxfrotextrude could share code
o Consider decoupling DXF-specific functionality from the 2D subsystem
o Make the interfaces from OpenSCAD and OpenCSG and CGAL cleaner to facilitate
diff --git a/src/expr.cc b/src/expr.cc
index 35fc776..23bcc32 100644
--- a/src/expr.cc
+++ b/src/expr.cc
@@ -81,7 +81,7 @@ Value Expression::evaluate(const Context *context) const
Value v2 = children[1]->evaluate(context);
if (v1.type == Value::VECTOR && v2.type == Value::NUMBER) {
int i = (int)(v2.num);
- if (i < v1.vec.size())
+ if (i >= 0 && i < v1.vec.size())
return *v1.vec[i];
}
return Value();
contact: Jan Huwald // Impressum