Commit eb169fd24e80ae377267be635061c3dae32a55c1

sammy 2008-04-13T09:06:38

* Fix a crash in FTContour::FTContour caused by invalid or unknown tags.

diff --git a/src/FTContour.cpp b/src/FTContour.cpp
index ca4a989..449b214 100644
--- a/src/FTContour.cpp
+++ b/src/FTContour.cpp
@@ -87,17 +87,18 @@ FTContour::FTContour(FT_Vector* contour, char* tags, unsigned int n)
     {
         if(tags[i] == FT_Curve_Tag_On || n < 2)
         {
-            AddPoint(contour[i]);
+            AddPoint(FTPoint(contour[i]));
             continue;
         }
 
         FTPoint cur(contour[i]);
-        FTPoint prev = (0 == i)
+        FTPoint prev = (pointList.size() == 0 || i == 0)
                        ? FTPoint(contour[n - 1])
                        : pointList[pointList.size() - 1];
-
         FTPoint next = (i == n - 1)
-                       ? pointList[0]
+                       ? (pointList.size() == 0)
+                         ? FTPoint(contour[0])
+                         : pointList[0]
                        : FTPoint(contour[i + 1]);
 
         if(tags[i] == FT_Curve_Tag_Conic)