Mapbox: Fix crash when using Marker.getTag() when tag was not set yet

This commit is contained in:
Marvin W 2020-09-02 21:11:53 +02:00
parent d42d8a81a4
commit 3ef330ad7b
No known key found for this signature in database
GPG Key ID: 072E9235DB996F2A
2 changed files with 4 additions and 3 deletions

View File

@ -272,7 +272,7 @@ class GoogleMapImpl(private val context: Context, var options: GoogleMapOptions)
return fill
}
override fun addMarker(options: MarkerOptions): IMarkerDelegate? {
override fun addMarker(options: MarkerOptions): IMarkerDelegate {
val marker = MarkerImpl(this, "m${markerId++}", options)
synchronized(this) {
val symbolManager = symbolManager

View File

@ -18,6 +18,7 @@ package org.microg.gms.maps.mapbox.model
import android.util.Log
import com.google.android.gms.dynamic.IObjectWrapper
import com.google.android.gms.dynamic.ObjectWrapper
import com.google.android.gms.maps.model.LatLng
import com.google.android.gms.maps.model.MarkerOptions
import com.google.android.gms.maps.model.internal.IMarkerDelegate
@ -199,9 +200,9 @@ class MarkerImpl(private val map: GoogleMapImpl, private val id: String, options
this.tag = obj
}
override fun getTag(): IObjectWrapper? = tag
override fun getTag(): IObjectWrapper = tag ?: ObjectWrapper.wrap(null)
companion object {
private val TAG = "GmsMapMarker"
}
}
}