From 40ddfaae7a5c66f4a3bae60cbbfc8c0e7fbf2159 Mon Sep 17 00:00:00 2001 From: Liz Kammer Date: Wed, 16 Dec 2020 10:59:00 -0800 Subject: [PATCH] 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 --- android/soongconfig/modules.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/android/soongconfig/modules.go b/android/soongconfig/modules.go index 5a6917ed0..9f3f804ef 100644 --- a/android/soongconfig/modules.go +++ b/android/soongconfig/modules.go @@ -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()