don't fix winding for empty paths

A path can be non-empty but become empty when it is simplified.
For instance, a path with the same rectangle, twice, with opposite
windings.

No contours are created for empty paths, so don't try to
fix their winding direction.

Additionally, check for a NULL coincidence since the
OpBuilder assumes that no concidence edges can be present
after the paths are simplified. This code should not get
called, but it's worth the future-proofing to check.

R=fmalita@chromium.org
BUG=502792

Review URL: https://codereview.chromium.org/1218863005
diff --git a/tests/PathOpsBuilderTest.cpp b/tests/PathOpsBuilderTest.cpp
index d36072f..df77100 100644
--- a/tests/PathOpsBuilderTest.cpp
+++ b/tests/PathOpsBuilderTest.cpp
@@ -135,3 +135,18 @@
     int pixelDiff = comparePaths(reporter, __FUNCTION__, path, result);
     REPORTER_ASSERT(reporter, pixelDiff == 0);
 }
+
+DEF_TEST(BuilderIssue502792_2, reporter) {
+    SkPath path, pathB;
+    path.setFillType(SkPath::kWinding_FillType);
+    path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
+    path.addRect(2, 2, 3, 3, SkPath::kCW_Direction);
+    pathB.setFillType(SkPath::kEvenOdd_FillType);
+    pathB.addRect(3, 3, 4, 4, SkPath::kCW_Direction);
+    pathB.addRect(3, 3, 4, 4, SkPath::kCW_Direction);
+    SkOpBuilder builder;
+    builder.add(path, kUnion_SkPathOp);
+    builder.add(pathB, kDifference_SkPathOp);
+    SkPath result;
+    builder.resolve(&result);
+}