package f0; import d0.z.d.o; import f0.e0.m.c; import java.security.cert.Certificate; import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.List; import kotlin.TypeCastException; import kotlin.jvm.functions.Function0; /* compiled from: CertificatePinner.kt */ /* loaded from: classes3.dex */ public final class h extends o implements Function0> { public final /* synthetic */ String $hostname; public final /* synthetic */ List $peerCertificates; public final /* synthetic */ g this$0; /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ public h(g gVar, List list, String str) { super(0); this.this$0 = gVar; this.$peerCertificates = list; this.$hostname = str; } @Override // kotlin.jvm.functions.Function0 public List invoke() { List list; c cVar = this.this$0.d; if (cVar == null || (list = cVar.a(this.$peerCertificates, this.$hostname)) == null) { list = this.$peerCertificates; } ArrayList arrayList = new ArrayList(d0.t.o.collectionSizeOrDefault(list, 10)); for (Certificate certificate : list) { if (certificate != null) { arrayList.add((X509Certificate) certificate); } else { throw new TypeCastException("null cannot be cast to non-null type java.security.cert.X509Certificate"); } } return arrayList; } }