discord-jadx/app/src/main/java/j0/l/a/k.java

79 lines
2.1 KiB
Java

package j0.l.a;
import j0.g;
import j0.o.l;
import java.util.Arrays;
import rx.Observable;
import rx.Subscriber;
import rx.exceptions.CompositeException;
/* compiled from: OnSubscribeDoOnEach */
public class k<T> implements Observable.a<T> {
public final g<? super T> i;
public final Observable<T> j;
/* compiled from: OnSubscribeDoOnEach */
public static final class a<T> extends Subscriber<T> {
public final Subscriber<? super T> i;
public final g<? super T> j;
public boolean k;
public a(Subscriber<? super T> subscriber, g<? super T> gVar) {
super(subscriber);
this.i = subscriber;
this.j = gVar;
}
@Override // j0.g
public void onCompleted() {
if (!this.k) {
try {
this.j.onCompleted();
this.k = true;
this.i.onCompleted();
} catch (Throwable th) {
c.q.a.k.a.a0(th);
onError(th);
}
}
}
@Override // j0.g
public void onError(Throwable th) {
if (this.k) {
l.b(th);
return;
}
this.k = true;
try {
this.j.onError(th);
this.i.onError(th);
} catch (Throwable th2) {
c.q.a.k.a.a0(th2);
this.i.onError(new CompositeException(Arrays.asList(th, th2)));
}
}
@Override // j0.g
public void onNext(T t) {
if (!this.k) {
try {
this.j.onNext(t);
this.i.onNext(t);
} catch (Throwable th) {
c.q.a.k.a.b0(th, this, t);
}
}
}
}
public k(Observable<T> observable, g<? super T> gVar) {
this.j = observable;
this.i = gVar;
}
@Override // rx.functions.Action1
public void call(Object obj) {
this.j.i0(new a((Subscriber) obj, this.i));
}
}