Skip to content

Commit

Permalink
Fix CameraPosition NullPointerException
Browse files Browse the repository at this point in the history
  • Loading branch information
DaVinci9196 committed Oct 24, 2024
1 parent 511afe8 commit 027a6cd
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ class GoogleMapImpl(private val context: Context, var options: GoogleMapOptions)
this.view = object : FrameLayout(mapContext) {}
}

override fun getCameraPosition(): CameraPosition? = map?.cameraPosition?.toGms()
override fun getCameraPosition(): CameraPosition {
return map?.cameraPosition?.toGms() ?: CameraPosition(LatLng(0.0, 0.0), 0f, 0f, 0f)
}
override fun getMaxZoomLevel(): Float = toHmsZoom(map?.maxZoomLevel ?: 18.toFloat())
override fun getMinZoomLevel(): Float = toHmsZoom(map?.minZoomLevel ?: 3.toFloat())

Expand Down

0 comments on commit 027a6cd

Please sign in to comment.