Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,22 @@ public OperatorOnErrorReturn(Func1<Throwable, ? extends T> resultFunction) {
public Subscriber<? super T> call(final Subscriber<? super T> child) {
return new Subscriber<T>(child) {

private boolean done = false;

@Override
public void onNext(T t) {
if (done) {
return;
}
child.onNext(t);
}

@Override
public void onError(Throwable e) {
if (done) {
return;
}
done = true;
try {
RxJavaPlugins.getInstance().getErrorHandler().handleError(e);
T result = resultFunction.call(e);
Expand All @@ -73,6 +82,10 @@ public void onError(Throwable e) {

@Override
public void onCompleted() {
if (done) {
return;
}
done = true;
child.onCompleted();
}

Expand Down