diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 23c00e0..682c945 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -894,17 +894,14 @@
 
 #include "SkGeometry.h"
 
-static int build_arc_points(const SkRect& oval, SkScalar startAngle,
-                            SkScalar sweepAngle,
-                            SkPoint pts[kSkBuildQuadArcStorage]) {
-
-    if (0 == sweepAngle &&
-        (0 == startAngle || SkIntToScalar(360) == startAngle)) {
+static bool arc_is_lone_point(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle,
+                              SkPoint* pt) {
+    if (0 == sweepAngle && (0 == startAngle || SkIntToScalar(360) == startAngle)) {
         // Chrome uses this path to move into and out of ovals. If not
         // treated as a special case the moves can distort the oval's
         // bounding box (and break the circle special case).
-        pts[0].set(oval.fRight, oval.centerY());
-        return 1;
+        pt->set(oval.fRight, oval.centerY());
+        return true;
     } else if (0 == oval.width() && 0 == oval.height()) {
         // Chrome will sometimes create 0 radius round rects. Having degenerate
         // quad segments in the path prevents the path from being recognized as
@@ -912,10 +909,14 @@
         // TODO: optimizing the case where only one of width or height is zero
         // should also be considered. This case, however, doesn't seem to be
         // as common as the single point case.
-        pts[0].set(oval.fRight, oval.fTop);
-        return 1;
+        pt->set(oval.fRight, oval.fTop);
+        return true;
     }
+    return false;
+}
 
+static int build_arc_points(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle,
+                            SkPoint pts[kSkBuildQuadArcStorage]) {
     SkVector start, stop;
 
     start.fY = SkScalarSinCos(SkDegreesToRadians(startAngle), &start.fX);
@@ -1309,13 +1310,20 @@
         return;
     }
 
+    if (fPathRef->countVerbs() == 0) {
+        forceMoveTo = true;
+    }
+
+    SkPoint lonePt;
+    if (arc_is_lone_point(oval, startAngle, sweepAngle, &lonePt)) {
+        forceMoveTo ? this->moveTo(lonePt) : this->lineTo(lonePt);
+        return;
+    }
+
     SkPoint pts[kSkBuildQuadArcStorage];
     int count = build_arc_points(oval, startAngle, sweepAngle, pts);
     SkASSERT((count & 1) == 1);
 
-    if (fPathRef->countVerbs() == 0) {
-        forceMoveTo = true;
-    }
     this->incReserve(count);
     forceMoveTo ? this->moveTo(pts[0]) : this->lineTo(pts[0]);
     for (int i = 1; i < count; i += 2) {
@@ -1335,6 +1343,12 @@
         return;
     }
 
+    SkPoint lonePt;
+    if (arc_is_lone_point(oval, startAngle, sweepAngle, &lonePt)) {
+        this->moveTo(lonePt);
+        return;
+    }
+
     SkPoint pts[kSkBuildQuadArcStorage];
     int count = build_arc_points(oval, startAngle, sweepAngle, pts);
 
