Commit 6141f71d7da25d1ed4b94d0d728b4954dfcc3b03

henry 2001-09-27T01:40:39

Added a test for an empty point list when adding points to a contour.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/src/FTVectoriser.cpp b/src/FTVectoriser.cpp
index cb08e57..54c66ac 100644
--- a/src/FTVectoriser.cpp
+++ b/src/FTVectoriser.cpp
@@ -20,7 +20,7 @@ void FTContour::AddPoint( const float x, const float y)
 	ftPoint point( x, y, 0.0); 
 	
 	// Eliminate duplicate points.
-	if( ( pointList[pointList.size() - 1] != point) && pointList[0] != point)
+	if( pointList.empty() || ( pointList[pointList.size() - 1] != point && pointList[0] != point))
 	{
 		pointList.push_back( point);
 	}
@@ -31,7 +31,6 @@ FTVectoriser::FTVectoriser( const FT_Glyph glyph)
 :	contourFlag(0),
 	contour(0),
 	kBSTEPSIZE( 0.2)
-
 {
 	FT_OutlineGlyph outline = (FT_OutlineGlyph)glyph;
 	ftOutline = outline->outline;