Skip to content

v0.2.53..v0.2.54 changeset SmallerOverlapExtractor.cpp

Garret Voltz edited this page Mar 31, 2020 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/algorithms/extractors/SmallerOverlapExtractor.cpp b/hoot-core/src/main/cpp/hoot/core/algorithms/extractors/SmallerOverlapExtractor.cpp
index b0bbf29..d173e67 100644
--- a/hoot-core/src/main/cpp/hoot/core/algorithms/extractors/SmallerOverlapExtractor.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/algorithms/extractors/SmallerOverlapExtractor.cpp
@@ -64,9 +64,12 @@ double SmallerOverlapExtractor::extract(const OsmMap& map, const ConstElementPtr
   ElementConverter ec(map.shared_from_this());
   ec.setRequireAreaForPolygonConversion(_requireAreaForPolygonConversion);
   std::shared_ptr<Geometry> g1 = ec.convertToGeometry(target);
+  if (g1->isEmpty())
+  {
+    return nullValue();
+  }
   std::shared_ptr<Geometry> g2 = ec.convertToGeometry(candidate);
-
-  if (g1->isEmpty() || g2->isEmpty())
+  if (g2->isEmpty())
   {
     return nullValue();
   }
@@ -96,7 +99,8 @@ double SmallerOverlapExtractor::extract(const OsmMap& map, const ConstElementPtr
     return 0.0;
   }
 
-  return std::min(1.0, overlapArea / min(a1, a2));
+  const double result = std::min(1.0, overlapArea / min(a1, a2));
+  return result;
 }
 
 }
Clone this wiki locally