Skip to content

Commit

Permalink
fix: avoid Polygon crash on empty list of points
Browse files Browse the repository at this point in the history
Fixes #666
  • Loading branch information
bubenheimer committed Dec 30, 2024
1 parent 212f3af commit e0c659d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,7 @@ private fun LocationMarker(
private fun Polygon(markerPositionsModel: () -> List<() -> LatLng>) {
val movingMarkerPositions = markerPositionsModel()

if (movingMarkerPositions.isNotEmpty()) {
val markerPositions = movingMarkerPositions.map { it() }
val markerPositions = movingMarkerPositions.map { it() }

Polygon(markerPositions)
}
Polygon(markerPositions)
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ public fun Polygon(
zIndex: Float = 0f,
onClick: (Polygon) -> Unit = {}
) {
if (points.isEmpty()) return // avoid SDK crash

val mapApplier = currentComposer.applier as MapApplier?
ComposeNode<PolygonNode, MapApplier>(
factory = {
Expand Down

0 comments on commit e0c659d

Please sign in to comment.