diff options
author | Colin Cross <ccross@android.com> | 2017-12-04 11:24:31 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2017-12-04 11:24:31 -0800 |
commit | e15ddaf4ae1de2e789197de3eb3f70ff40327a5b (patch) | |
tree | b64495a06a849b7ae19e57529141cad93a9d2c52 /android/config.go | |
parent | 42f3a76f0098b26029d9f8906b3085219d48ee36 (diff) | |
download | build_soong-e15ddaf4ae1de2e789197de3eb3f70ff40327a5b.tar.gz build_soong-e15ddaf4ae1de2e789197de3eb3f70ff40327a5b.tar.bz2 build_soong-e15ddaf4ae1de2e789197de3eb3f70ff40327a5b.zip |
Fix builds outside of make
Builds outside of make use custom config files that may not set
some variables, which is causing nil pointer derefernces. Use
wrapper functions that check for nil for the new config
variables.
Test: build/soong/scripts/build-ndk-prebuilts.sh
Change-Id: I0f837094532aeb2ecdbe401affa55a7535075bf6
Diffstat (limited to 'android/config.go')
-rw-r--r-- | android/config.go | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/android/config.go b/android/config.go index 8ae6471b..a4624c7a 100644 --- a/android/config.go +++ b/android/config.go @@ -475,19 +475,19 @@ func (c *config) PlatformVersionCombinedCodenames() []string { } func (c *config) ProductAAPTConfig() []string { - return *c.ProductVariables.AAPTConfig + return stringSlice(c.ProductVariables.AAPTConfig) } func (c *config) ProductAAPTPreferredConfig() string { - return *c.ProductVariables.AAPTPreferredConfig + return String(c.ProductVariables.AAPTPreferredConfig) } func (c *config) ProductAAPTCharacteristics() string { - return *c.ProductVariables.AAPTCharacteristics + return String(c.ProductVariables.AAPTCharacteristics) } func (c *config) ProductAAPTPrebuiltDPI() []string { - return *c.ProductVariables.AAPTPrebuiltDPI + return stringSlice(c.ProductVariables.AAPTPrebuiltDPI) } func (c *config) DefaultAppCertificateDir(ctx PathContext) SourcePath { @@ -686,3 +686,11 @@ func (c *config) CFIEnabledForPath(path string) bool { } return prefixInList(path, *c.ProductVariables.CFIIncludePaths) } + +func stringSlice(s *[]string) []string { + if s != nil { + return *s + } else { + return nil + } +} |