Skip to content

Commit

Permalink
Fix LifecycleEventsObservable not observing observer contract
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacSweers committed Nov 18, 2017
1 parent 07f0f1e commit ec190c0
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ void backfillEvents() {
}

@Override protected void subscribeActual(Observer<? super Event> observer) {
ArchLifecycleObserver archObserver =
new ArchLifecycleObserver(lifecycle, observer, eventsObservable);
observer.onSubscribe(archObserver);
if (!isMainThread()) {
observer.onError(
new IllegalStateException("Lifecycles can only be bound to on the main thread!"));
return;
}
ArchLifecycleObserver archObserver =
new ArchLifecycleObserver(lifecycle, observer, eventsObservable);
observer.onSubscribe(archObserver);
lifecycle.addObserver(archObserver);
}

Expand Down

0 comments on commit ec190c0

Please sign in to comment.