mcharmas / Android-ReactiveLocation

Small library that wraps Google Play Service API in brilliant RxJava Observables reducing boilerplate to minimum.
2.11k stars 312 forks source link

UndeliverableException in FallbackReverseGeocodeObservable #169

Closed niqo01 closed 6 years ago

niqo01 commented 6 years ago

See bug details including stacktrace here: http://crashes.to/s/18f5d0e0917

I am not too familiar with this library code but I think the following code: https://github.com/mcharmas/Android-ReactiveLocation/blob/master/android-reactive-location/src/main/java/pl/charmas/android/reactivelocation2/observables/geocode/FallbackReverseGeocodeObservable.java#L43

    public void subscribe(ObservableEmitter<List<Address>> emitter) throws Exception {
        try {
            emitter.onNext(alternativeReverseGeocodeQuery());
            emitter.onComplete();
        } catch (Exception ex) {
            emitter.onError(ex);
        }
    }

Should probably be something like :

    public void subscribe(ObservableEmitter<List<Address>> emitter) throws Exception {
        try {
            List<Address>  lists = alternativeReverseGeocodeQuery()
            if (!emitter.isDisposed()) {
                 emitter.onNext(lists);
                 emitter.onComplete();
           }
        } catch (Exception ex) {
           if (!emitter.isDisposed()) emitter.onError(ex);
        }
    }
niqo01 commented 6 years ago

Another one: http://crashes.to/s/dba64fa4376

Lir10 commented 6 years ago

@niqo01 @mcharmas

Exactly, got the same crashes alot!

!emitter.isDisposed() is the solution.

mcharmas commented 6 years ago

Should be fixed in 2.1. Propagating to maven central. Should be available in few hours.