discord-jadx/app/src/main/java/s/a/i0.java

114 lines
3.7 KiB
Java

package s.a;
import c.q.a.k.a;
import d0.b;
import d0.k;
import d0.l;
import d0.z.d.m;
import java.util.concurrent.CancellationException;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlinx.coroutines.Job;
import s.a.a.f;
import s.a.y1.h;
import s.a.y1.i;
/* compiled from: DispatchedTask.kt */
public abstract class i0<T> extends h {
public int k;
public i0(int i) {
this.k = i;
}
public void c(Object obj, Throwable th) {
}
public abstract Continuation<T> d();
public Throwable f(Object obj) {
if (!(obj instanceof u)) {
obj = null;
}
u uVar = (u) obj;
if (uVar != null) {
return uVar.b;
}
return null;
}
/* JADX DEBUG: Multi-variable search result rejected for r1v0, resolved type: java.lang.Object */
/* JADX WARN: Multi-variable type inference failed */
public <T> T l(Object obj) {
return obj;
}
public final void m(Throwable th, Throwable th2) {
if (th != null || th2 != null) {
if (!(th == null || th2 == null)) {
b.addSuppressed(th, th2);
}
if (th == null) {
th = th2;
}
m.checkNotNull(th);
a.w(d().getContext(), new b0("Fatal exception in coroutines machinery for " + this + ". Please read KDoc to 'handleFatalException' method and report this incident to maintainers", th));
}
}
public abstract Object n();
@Override // java.lang.Runnable
public final void run() {
Object obj;
Object obj2;
i iVar = this.j;
try {
Continuation<T> d = d();
if (d != null) {
f fVar = (f) d;
Continuation<T> continuation = fVar.q;
CoroutineContext context = continuation.getContext();
Object n = n();
Object b = s.a.a.a.b(context, fVar.o);
try {
Throwable f = f(n);
Job job = (f != null || !a.B(this.k)) ? null : (Job) context.get(Job.h);
if (job != null && !job.a()) {
CancellationException p = job.p();
c(n, p);
k.a aVar = k.i;
continuation.resumeWith(k.m78constructorimpl(l.createFailure(p)));
} else if (f != null) {
k.a aVar2 = k.i;
continuation.resumeWith(k.m78constructorimpl(l.createFailure(f)));
} else {
T l = l(n);
k.a aVar3 = k.i;
continuation.resumeWith(k.m78constructorimpl(l));
}
Unit unit = Unit.a;
try {
k.a aVar4 = k.i;
iVar.e();
obj2 = k.m78constructorimpl(unit);
} catch (Throwable th) {
k.a aVar5 = k.i;
obj2 = k.m78constructorimpl(l.createFailure(th));
}
m(null, k.m80exceptionOrNullimpl(obj2));
return;
} finally {
s.a.a.a.a(context, b);
}
} else {
throw new NullPointerException("null cannot be cast to non-null type kotlinx.coroutines.internal.DispatchedContinuation<T>");
}
} catch (Throwable th2) {
k.a aVar6 = k.i;
obj = k.m78constructorimpl(l.createFailure(th2));
}
m(th, k.m80exceptionOrNullimpl(obj));
}
}