Skip to content

Commit

Permalink
fix: avoid Polygon crash on empty list of points (#667)
Browse files Browse the repository at this point in the history
Fixes #666

Co-authored-by: Uli Bubenheimer <[email protected]>
  • Loading branch information
bubenheimer and bubenheimer authored Jan 2, 2025
1 parent 17af9d1 commit 1310804
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 1310804

Please sign in to comment.