Skip to content

Commit

Permalink
Fix getMapAsync() for LiteGoogleMap
Browse files Browse the repository at this point in the history
Spotify was crashing because of some lateinit property in Spotify snapshot ready
callback was not initialized.

Looking at the condition we can observe that GmsCore was calling the snapshot ready
callback when the snapshot was null, which does not make sense.

Inverting the logic and calling the callback when the snapshot was not null anymore
fixed the issue and Spotify was able to display the snapshot.
  • Loading branch information
jonathanklee authored and mar-v-in committed Sep 27, 2024
1 parent b4754b8 commit d9df3fa
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ class LiteGoogleMapImpl(context: Context, var options: GoogleMapOptions) : Abstr
}

fun getMapAsync(callback: IOnMapReadyCallback) {
if (lastSnapshot == null) {
if (lastSnapshot != null) {
Log.d(TAG, "Invoking callback instantly, as a snapshot is ready")
callback.onMapReady(this)
} else {
Expand Down

0 comments on commit d9df3fa

Please sign in to comment.