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 committed Sep 6, 2024
1 parent 108bd88 commit 7ebecb0
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 7ebecb0

Please sign in to comment.