aboutsummaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2017-06-22 15:34:51 -0700
committerColin Cross <ccross@android.com>2017-06-23 10:57:36 -0700
commit20e1365e61017fddfdefde05e3e2ca8c2f6ae080 (patch)
tree41015def29d1daf57af1f3d35e4251e1050b2839 /android
parent405ce4d352ca12cbc58f1a6777c6bfac4862a390 (diff)
downloadbuild_soong-20e1365e61017fddfdefde05e3e2ca8c2f6ae080.tar.gz
build_soong-20e1365e61017fddfdefde05e3e2ca8c2f6ae080.tar.bz2
build_soong-20e1365e61017fddfdefde05e3e2ca8c2f6ae080.zip
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
Diffstat (limited to 'android')
-rw-r--r--android/config.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/android/config.go b/android/config.go
index c3beb08e..1f29d942 100644
--- a/android/config.go
+++ b/android/config.go
@@ -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: