Skip to content

Commit

Permalink
Fixed weak reference access inside location listener
Browse files Browse the repository at this point in the history
  • Loading branch information
mcharmas committed Sep 29, 2017
1 parent 169142f commit d4e4294
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ private static class LocationUpdatesLocationListener implements LocationListener

@Override
public void onLocationChanged(Location location) {
if (weakRef.get() == null) {
return;
final Observer<? super Location> observer = weakRef.get();
if (observer != null) {
observer.onNext(location);
}
weakRef.get().onNext(location);
}
}
}

0 comments on commit d4e4294

Please sign in to comment.