Skip to content

Commit

Permalink
add error message on invalid geometry
Browse files Browse the repository at this point in the history
Co-authored-by: Finn-Rasmus Darge<[email protected]>
  • Loading branch information
warm-coolguy committed Apr 26, 2024
1 parent c6beefa commit 9197c6c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/plugins/Measure/src/utils/createStyleFunc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,15 @@ export default function (
const styles = [polygonStyle, pointStyle]
const geom = feature.getGeometry() as Polygon | LineString

if (geom.getType() !== 'LineString' && geom.getType() !== 'Polygon') {
return styles
if (
!geom ||
(geom.getType() !== 'LineString' && geom.getType() !== 'Polygon')
) {
console.error(
'@polar/plugin-measure: Unsupported geometry type or undefined geometry:',
geom
)
return []
}

const coordinates: Coordinate[] =
Expand Down

0 comments on commit 9197c6c

Please sign in to comment.