package o; import io.reactivex.rxjava3.exceptions.CompositeException; /* renamed from: o.fZj, reason: case insensitive filesystem */ /* loaded from: classes6.dex */ public final class C13407fZj implements InterfaceC13174fSv, fSJ { private fSJ b; private boolean d; private InterfaceC13174fSv e; public C13407fZj(InterfaceC13174fSv interfaceC13174fSv) { this.e = interfaceC13174fSv; } @Override // o.InterfaceC13174fSv public final void onSubscribe(fSJ fsj) { if (EnumC13192fTf.d(this.b, fsj)) { this.b = fsj; try { this.e.onSubscribe(this); } catch (Throwable th) { C13147fSI.c(th); this.d = true; try { fsj.dispose(); C13418fZu.c(th); } catch (Throwable th2) { C13147fSI.c(th2); C13418fZu.c(new CompositeException(th, th2)); } } } } @Override // o.fSJ public final void dispose() { this.b.dispose(); } @Override // o.fSJ public final boolean isDisposed() { return this.b.isDisposed(); } @Override // o.InterfaceC13174fSv public final void onNext(T t) { if (this.d) { return; } if (this.b == null) { this.d = true; NullPointerException nullPointerException = new NullPointerException("Subscription not set!"); try { this.e.onSubscribe(EnumC13195fTi.INSTANCE); try { this.e.onError(nullPointerException); return; } catch (Throwable th) { C13147fSI.c(th); C13418fZu.c(new CompositeException(nullPointerException, th)); return; } } catch (Throwable th2) { C13147fSI.c(th2); C13418fZu.c(new CompositeException(nullPointerException, th2)); return; } } if (t == null) { NullPointerException c = fYR.c("onNext called with a null value."); try { this.b.dispose(); onError(c); return; } catch (Throwable th3) { C13147fSI.c(th3); onError(new CompositeException(c, th3)); return; } } try { this.e.onNext(t); } catch (Throwable th4) { C13147fSI.c(th4); try { this.b.dispose(); onError(th4); } catch (Throwable th5) { C13147fSI.c(th5); onError(new CompositeException(th4, th5)); } } } @Override // o.InterfaceC13174fSv public final void onError(Throwable th) { if (this.d) { C13418fZu.c(th); return; } this.d = true; if (this.b == null) { NullPointerException nullPointerException = new NullPointerException("Subscription not set!"); try { this.e.onSubscribe(EnumC13195fTi.INSTANCE); try { this.e.onError(new CompositeException(th, nullPointerException)); return; } catch (Throwable th2) { C13147fSI.c(th2); C13418fZu.c(new CompositeException(th, nullPointerException, th2)); return; } } catch (Throwable th3) { C13147fSI.c(th3); C13418fZu.c(new CompositeException(th, nullPointerException, th3)); return; } } if (th == null) { th = fYR.c("onError called with a null Throwable."); } try { this.e.onError(th); } catch (Throwable th4) { C13147fSI.c(th4); C13418fZu.c(new CompositeException(th, th4)); } } @Override // o.InterfaceC13174fSv public final void onComplete() { if (this.d) { return; } this.d = true; if (this.b != null) { try { this.e.onComplete(); return; } catch (Throwable th) { C13147fSI.c(th); C13418fZu.c(th); return; } } NullPointerException nullPointerException = new NullPointerException("Subscription not set!"); try { this.e.onSubscribe(EnumC13195fTi.INSTANCE); try { this.e.onError(nullPointerException); } catch (Throwable th2) { C13147fSI.c(th2); C13418fZu.c(new CompositeException(nullPointerException, th2)); } } catch (Throwable th3) { C13147fSI.c(th3); C13418fZu.c(new CompositeException(nullPointerException, th3)); } } }