HMS-Core / hms-mapkit-demo

HMS Map Kit demo provides an example of intergrating HMS Map Android SDK. Personalizing how your map displays and interacts with your users tailors their experience to them
https://developer.huawei.com/consumer/en/hms/huawei-MapKit?ha_source=hms1
Apache License 2.0
115 stars 43 forks source link

Crash on map loading when back button pressed when marker clustering = true #8

Closed goblinr closed 3 years ago

goblinr commented 3 years ago

Scenario: HMS Map Kit version = 5.0.1.301 Markers clustering = true

  1. Open a fragment with a map
  2. Markers are added
  3. We do not allow the map to load, immediately press the "Back" button
  4. We get an application crash
java.lang.NullPointerException: Attempt to invoke virtual method 'com.huawei.map.mapapi.model.Marker com.huawei.map.mapapi.HWMap.addMarker(com.huawei.map.mapapi.model.MarkerOptions)' on a null object reference
        at com.huawei.hms.maps.provider.markercluster.clustering.view.e$d.b(:10711)
        at com.huawei.hms.maps.provider.markercluster.clustering.view.e$e.handleMessage(:1880)
        at android.os.Handler.dispatchMessage(Handler.java:110)
        at android.os.Looper.loop(Looper.java:219)
        at android.app.ActivityThread.main(ActivityThread.java:8347)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055)
lovehuaweimaps commented 3 years ago

Thank you for your feedback, we will fix this problem in the next version as soon as possible.

Mike-mei commented 3 years ago

@goblinr This issue has been fixed, you can download the latest sample code and try it again.