diff --git a/android-reactive-location/src/main/java/pl/charmas/android/reactivelocation/observables/location/LocationUpdatesObservable.java b/android-reactive-location/src/main/java/pl/charmas/android/reactivelocation/observables/location/LocationUpdatesObservable.java index 77b69503..062faee6 100644 --- a/android-reactive-location/src/main/java/pl/charmas/android/reactivelocation/observables/location/LocationUpdatesObservable.java +++ b/android-reactive-location/src/main/java/pl/charmas/android/reactivelocation/observables/location/LocationUpdatesObservable.java @@ -55,10 +55,10 @@ private static class LocationUpdatesLocationListener implements LocationListener @Override public void onLocationChanged(Location location) { - if (weakRef.get() == null) { - return; + final Observer observer = weakRef.get(); + if (observer != null) { + observer.onNext(location); } - weakRef.get().onNext(location); } } }