package o; /* loaded from: classes6.dex */ public final class fTR implements InterfaceC13174fSv, fSJ { private fSQ a; private InterfaceC13174fSv c; private fSJ d; private fSP e; public fTR(InterfaceC13174fSv interfaceC13174fSv, fSQ fsq, fSP fsp) { this.c = interfaceC13174fSv; this.a = fsq; this.e = fsp; } @Override // o.InterfaceC13174fSv public final void onSubscribe(fSJ fsj) { try { this.a.c(fsj); if (EnumC13192fTf.d(this.d, fsj)) { this.d = fsj; this.c.onSubscribe(this); } } catch (Throwable th) { C13147fSI.c(th); fsj.dispose(); this.d = EnumC13192fTf.DISPOSED; EnumC13195fTi.a(th, this.c); } } @Override // o.InterfaceC13174fSv public final void onNext(T t) { this.c.onNext(t); } @Override // o.InterfaceC13174fSv public final void onError(Throwable th) { if (this.d != EnumC13192fTf.DISPOSED) { this.d = EnumC13192fTf.DISPOSED; this.c.onError(th); } else { C13418fZu.c(th); } } @Override // o.InterfaceC13174fSv public final void onComplete() { if (this.d != EnumC13192fTf.DISPOSED) { this.d = EnumC13192fTf.DISPOSED; this.c.onComplete(); } } @Override // o.fSJ public final void dispose() { fSJ fsj = this.d; if (fsj != EnumC13192fTf.DISPOSED) { this.d = EnumC13192fTf.DISPOSED; try { this.e.c(); } catch (Throwable th) { C13147fSI.c(th); C13418fZu.c(th); } fsj.dispose(); } } @Override // o.fSJ public final boolean isDisposed() { return this.d.isDisposed(); } }