Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c53c37fa authored by Colin Cross's avatar Colin Cross
Browse files

Don't panic when DevicePrimaryArchType is called in a host only build

Check the length of c.Targets[Android] before getting the first
element, and return Common if the length is set.  Fixes a panic
when a tradefed_binary is defined in a host-only build.

Test: aosp-build-tools build
Change-Id: I89f1dd13aa1aff5eb7d39e0b66eeedcb7d930fa0
parent ce697573
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -892,8 +892,13 @@ func (c *config) Eng() bool {
	return Bool(c.productVariables.Eng)
}

// DevicePrimaryArchType returns the ArchType for the first configured device architecture, or
// Common if there are no device architectures.
func (c *config) DevicePrimaryArchType() ArchType {
	return c.Targets[Android][0].Arch.ArchType
	if androidTargets := c.Targets[Android]; len(androidTargets) > 0 {
		return androidTargets[0].Arch.ArchType
	}
	return Common
}

func (c *config) SanitizeHost() []string {