yayaa / LocationManager

Simplify getting user's location for Android
807 stars 186 forks source link

Attempt to invoke virtual method 'void com.yayandroid.locationmanager.helper.UpdateRequest.c()' on a null object reference #90

Closed diegolaballos closed 4 years ago

diegolaballos commented 6 years ago

App crash reported by Crashlytics (not sure when it happens)

Logs

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.yayandroid.locationmanager.helper.UpdateRequest.c()' on a null object reference at com.yayandroid.locationmanager.providers.locationprovider.DefaultLocationProvider.cancel(SourceFile:52) at com.yayandroid.locationmanager.providers.locationprovider.DispatcherLocationProvider.cancel(SourceFile:68) at com.yayandroid.locationmanager.providers.locationprovider.DispatcherLocationProvider.onFallback(SourceFile:130) at com.yayandroid.locationmanager.providers.locationprovider.GooglePlayServicesLocationProvider.failed(SourceFile:266) at com.yayandroid.locationmanager.providers.locationprovider.GooglePlayServicesLocationProvider.onConnectionSuspended(SourceFile:137) at com.yayandroid.locationmanager.providers.locationprovider.GooglePlayServicesLocationSource.onConnectionSuspended(SourceFile:118) at com.google.android.gms.common.internal.GmsClientEventManager.disableCallbacks(Unknown Source:82) at com.google.android.gms.common.api.internal.zzav.enqueue(Unknown Source:68) at com.google.android.gms.common.api.internal.zzag.begin(Unknown Source:12) at com.google.android.gms.common.api.internal.zzbd.onConnectionSuspended(Unknown Source:7) at com.google.android.gms.common.api.internal.zzp.onConnectionSuspended(Unknown Source:5) at com.google.android.gms.common.internal.zzf.onConnected(Unknown Source:2) at com.google.android.gms.common.internal.BaseGmsClient$zzb.handleMessage(Unknown Source:227) at android.os.Handler.dispatchMessage(Handler.java:108) at android.os.Looper.loop(Looper.java:166) at android.app.ActivityThread.main(ActivityThread.java:7425) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)

yayaa commented 4 years ago

Sorry for late action, but this should solve the problem. Considering the crash happens on removing updates when locationManager is null - that means update request is long gone with locationManager itself as well, so it is safe to just add a null-check before the attempt of removing.

I'll try to do other bugfixes as well, and release 2.1.0 version as short term plan.