summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dxfdata.cc9
-rw-r--r--testdata/scad/dxf/nothing-decimal-comma-separated.scad2
2 files changed, 6 insertions, 5 deletions
diff --git a/src/dxfdata.cc b/src/dxfdata.cc
index 4afe512..ffea169 100644
--- a/src/dxfdata.cc
+++ b/src/dxfdata.cc
@@ -178,12 +178,13 @@ DxfData::DxfData(double fn, double fs, double fa,
ADD_LINE(xverts.at(0), yverts.at(0), xverts.at(1), yverts.at(1));
}
else if (mode == "LWPOLYLINE") {
- assert(xverts.size() == yverts.size());
- // polyline flag is stored in 'dimtype'
- int numverts = xverts.size();
+ // assert(xverts.size() == yverts.size());
+ // Get maximum to enforce managed exception if xverts.size() != yverts.size()
+ int numverts = std::max(xverts.size(), yverts.size());
for (int i=1;i<numverts;i++) {
- ADD_LINE(xverts[i-1], yverts[i-1], xverts[i%numverts], yverts[i%numverts]);
+ ADD_LINE(xverts.at(i-1), yverts.at(i-1), xverts.at(i%numverts), yverts.at(i%numverts));
}
+ // polyline flag is stored in 'dimtype'
if (dimtype & 0x01) { // closed polyline
ADD_LINE(xverts.at(numverts-1), yverts.at(numverts-1), xverts.at(0), yverts.at(0));
}
diff --git a/testdata/scad/dxf/nothing-decimal-comma-separated.scad b/testdata/scad/dxf/nothing-decimal-comma-separated.scad
index 204ce08..83219cd 100644
--- a/testdata/scad/dxf/nothing-decimal-comma-separated.scad
+++ b/testdata/scad/dxf/nothing-decimal-comma-separated.scad
@@ -1,2 +1,2 @@
// This tests should not crash but produce no visible result, see former issue 593.
-import("../../nothing-decimal-comma-separated.dxf");
+import("../../dxf/nothing-decimal-comma-separated.dxf");
contact: Jan Huwald // Impressum