check for NaN in path iterator (otherwise we have an infinite loop)



git-svn-id: http://skia.googlecode.com/svn/trunk@131 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 3d5ccda..97b366d 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -989,6 +989,14 @@
 
 SkPath::Verb SkPath::Iter::autoClose(SkPoint pts[2]) {
     if (fLastPt != fMoveTo) {
+        // A special case: if both points are NaN, SkPoint::operation== returns
+        // false, but the iterator expects that they are treated as the same.
+        // (consider SkPoint is a 2-dimension float point).
+        if (SkScalarIsNaN(fLastPt.fX) && SkScalarIsNaN(fLastPt.fY) &&
+            SkScalarIsNaN(fMoveTo.fX) && SkScalarIsNaN(fMoveTo.fY)) {
+            return kClose_Verb;
+        }
+
         if (pts) {
             pts[0] = fLastPt;
             pts[1] = fMoveTo;