package com.google.android.gms.tasks; import java.util.concurrent.CancellationException; /* loaded from: classes.dex */ final class zzo implements Runnable { final Task zza; final zzp zzb; @Override // java.lang.Runnable public final void run() { SuccessContinuation successContinuation; try { successContinuation = this.zzb.zzb; Task then = successContinuation.then(this.zza.getResult()); if (then == null) { this.zzb.onFailure(new NullPointerException("Continuation returned null")); return; } then.addOnSuccessListener(TaskExecutors.zza, this.zzb); then.addOnFailureListener(TaskExecutors.zza, this.zzb); then.addOnCanceledListener(TaskExecutors.zza, this.zzb); } catch (RuntimeExecutionException e) { if (e.getCause() instanceof Exception) { this.zzb.onFailure((Exception) e.getCause()); } else { this.zzb.onFailure(e); } } catch (CancellationException unused) { this.zzb.onCanceled(); } catch (Exception e2) { this.zzb.onFailure(e2); } } /* JADX INFO: Access modifiers changed from: package-private */ public zzo(zzp zzpVar, Task task) { this.zzb = zzpVar; this.zza = task; } }