package o; import java.util.concurrent.atomic.AtomicReference; /* loaded from: classes.dex */ public final class fXY extends AbstractC13175fSw { private fSB e; public fXY(fSB fsb) { this.e = fsb; } @Override // o.AbstractC13175fSw public final void e(InterfaceC13176fSx interfaceC13176fSx) { LWm lWm = new LWm(interfaceC13176fSx); interfaceC13176fSx.onSubscribe(lWm); try { this.e.d(lWm); } catch (Throwable th) { C13147fSI.c(th); if (lWm.b(th)) { return; } C13418fZu.c(th); } } /* loaded from: classes6.dex */ static final class LWm extends AtomicReference implements InterfaceC13178fSz, fSJ { private InterfaceC13176fSx b; LWm(InterfaceC13176fSx interfaceC13176fSx) { this.b = interfaceC13176fSx; } @Override // o.InterfaceC13178fSz public final void c(T t) { fSJ andSet; if (get() == EnumC13192fTf.DISPOSED || (andSet = getAndSet(EnumC13192fTf.DISPOSED)) == EnumC13192fTf.DISPOSED) { return; } try { if (t == null) { this.b.onError(fYR.c("onSuccess called with a null value.")); } else { this.b.e(t); } if (andSet != null) { andSet.dispose(); } } catch (Throwable th) { if (andSet != null) { andSet.dispose(); } throw th; } } @Override // o.InterfaceC13178fSz public final void e(Throwable th) { if (b(th)) { return; } C13418fZu.c(th); } public final boolean b(Throwable th) { fSJ andSet; if (th == null) { th = fYR.c("onError called with a null Throwable."); } if (get() == EnumC13192fTf.DISPOSED || (andSet = getAndSet(EnumC13192fTf.DISPOSED)) == EnumC13192fTf.DISPOSED) { return false; } try { this.b.onError(th); } finally { if (andSet != null) { andSet.dispose(); } } } @Override // o.fSJ public final void dispose() { EnumC13192fTf.e(this); } @Override // o.fSJ public final boolean isDisposed() { return EnumC13192fTf.c(get()); } @Override // java.util.concurrent.atomic.AtomicReference public final String toString() { return String.format("%s{%s}", getClass().getSimpleName(), super.toString()); } } }