Check whether value_variables are set

If value variable had not been set by a user, previously we would error
out. Now, we just skip it.

Test: go test soong tests
Test: m nothing
Change-Id: Ibab67e00b28055b5feee2f4fd79bf4dfb2fc6704
This commit is contained in:
Liz Kammer 2020-12-16 10:59:00 -08:00
parent 41351b5334
commit 40ddfaae7a
1 changed files with 4 additions and 1 deletions

View File

@ -541,12 +541,15 @@ func (s *valueVariable) initializeProperties(v reflect.Value, typ reflect.Type)
}
func (s *valueVariable) PropertiesToApply(config SoongConfig, values reflect.Value) (interface{}, error) {
if !config.IsSet(s.variable) {
if !config.IsSet(s.variable) || !values.IsValid() {
return nil, nil
}
configValue := config.String(s.variable)
propStruct := values.Elem().Elem()
if !propStruct.IsValid() {
return nil, nil
}
for i := 0; i < propStruct.NumField(); i++ {
field := propStruct.Field(i)
kind := field.Kind()