Skip to content

Commit

Permalink
[TM-920] Avoid a divide by 0 error.
Browse files Browse the repository at this point in the history
  • Loading branch information
roguenet committed Jun 5, 2024
1 parent e9e470a commit 20e78a8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/Validators/Extensions/Polygons/WithinCountry.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public static function getIntersectionData(string $polygonUuid): array
if ($geometry === null) {
return ['valid' => false, 'status' => 404, 'error' => 'Geometry not found'];
}
if ($geometry->db_geometry->area == 0) {
return ['valid' => false, 'status' => 500, 'error' => 'Geometry invalid'];
}

$sitePolygonData = SitePolygon::forPolygonGeometry($polygonUuid)->select('site_id')->first();
if ($sitePolygonData == null) {
Expand Down

0 comments on commit 20e78a8

Please sign in to comment.