From d1f548a19d1058ff806a4db89f40a64a06a7f14f Mon Sep 17 00:00:00 2001 From: Zyan Wu Date: Thu, 18 May 2023 15:46:31 +0800 Subject: Don't panic if no certificates found Getting the first certificate will panic if there are no certificates, which can happen when AllowMissingDependencies is set and the certificate property is a module reference to a missing module. Only get the first certificate if the list is not nil. Use mainCertificate since it handles the logic already. Test: TestAppMissingCertificateAllowMissingDependencies Bug: 283102635 Merged-In: : I8b27f65aa7d071041171ad45ac52bf47fa31bf2b Change-Id: Icaaa45d48ca4edb876687c0813165d107d28ef8a --- java/app_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'java/app_test.go') diff --git a/java/app_test.go b/java/app_test.go index 7e97b0fb1..b154bc990 100644 --- a/java/app_test.go +++ b/java/app_test.go @@ -3382,6 +3382,14 @@ func TestAppMissingCertificateAllowMissingDependencies(t *testing.T) { srcs: ["a.java"], certificate: ":missing_certificate", sdk_version: "current", + } + + android_app { + name: "bar", + srcs: ["a.java"], + certificate: ":missing_certificate", + product_specific: true, + sdk_version: "current", }`) foo := result.ModuleForTests("foo", "android_common") -- cgit v1.2.3-59-g8ed1b