Fix panic in builds with no device

Running prebuilts/build-tools/build-prebuilts.sh in a repo that
contains art/build/art.go panics because config.Targets[Device] is
empty.  Check the length before accessing the slice.

Test: prebuilts/build-tools/build-prebuilts.sh
Change-Id: Ifb9fe0fad07b22d6b574f505c08c5c761278aad0
This commit is contained in:
Colin Cross
2017-06-22 15:34:51 -07:00
parent 405ce4d352
commit 20e1365e61

View File

@@ -466,7 +466,11 @@ func (c *config) LibartImgHostBaseAddress() string {
}
func (c *config) LibartImgDeviceBaseAddress() string {
switch c.Targets[Device][0].Arch.ArchType {
archType := Common
if len(c.Targets[Device]) > 0 {
archType = c.Targets[Device][0].Arch.ArchType
}
switch archType {
default:
return "0x70000000"
case Mips, Mips64: