From 6ee78e7f68e70f121625327aa97f979551e692b3 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Thu, 9 May 2013 14:32:43 +0200 Subject: [PATCH] Handle lack of trailing newline in dat files. Fixes #336 --- src/surface.cc | 2 +- testdata/scad/features/surface-simple.dat | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/surface.cc b/src/surface.cc index 46ddc070..7987b999 100644 --- a/src/surface.cc +++ b/src/surface.cc @@ -122,7 +122,7 @@ PolySet *SurfaceNode::evaluate_polyset(class PolySetEvaluator *) const std::getline(stream, line); boost::trim(line); } - if (stream.eof()) break; + if (line.size() == 0 && stream.eof()) break; int col = 0; tokenizer tokens(line, sep); diff --git a/testdata/scad/features/surface-simple.dat b/testdata/scad/features/surface-simple.dat index 32eba08b..166c6006 100644 --- a/testdata/scad/features/surface-simple.dat +++ b/testdata/scad/features/surface-simple.dat @@ -1,2 +1,6 @@ 0 1 2 3 + +# Comment + +