fix: NPE when removing single location updates #248
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
When getting the location from playServices, the app crashes for some users. Not able to reproduce it.
It has also been reported Here
#Crash Log
Fatal Exception: java.lang.NullPointerException: Listener must not be null at com.google.android.gms.common.internal.Preconditions.checkNotNull(SourceFile:2) at com.google.android.gms.common.api.internal.ListenerHolders.createListenerKey(SourceFile:1) at com.google.android.gms.location.FusedLocationProviderClient.removeLocationUpdates(SourceFile:6) at o.computeScrollRange$4.onLocationResult(SourceFile:74) at com.google.android.gms.internal.location.zzaw.notifyListener(SourceFile:2) at com.google.android.gms.common.api.internal.ListenerHolder.zaa(SourceFile:2) at com.google.android.gms.common.api.internal.zacb.run(:4) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:257) at android.app.ActivityThread.main(ActivityThread.java:8183) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:626) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1015)
Test Plan
I'm assuming the fix is straightforward. We deployed a patch of this in our app with success.