Skip to content

Commit 42cda01

Browse files
authored
Merge pull request #42 from drone/maint_nil_checks
(maint) Adds attributes nil check to target
2 parents 4c14473 + 4e4d896 commit 42cda01

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

evaluation/target.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ type Target struct {
2020
// GetAttrValue returns value from target with specified attribute
2121
func (t Target) GetAttrValue(attr string) reflect.Value {
2222
var value reflect.Value
23-
attrs := *t.Attributes
23+
attrs := make(map[string]interface{})
24+
if t.Attributes != nil {
25+
attrs = *t.Attributes
26+
}
27+
2428
attrVal, ok := attrs[attr] // first check custom attributes
2529
if ok {
2630
value = reflect.ValueOf(attrVal)

test_wrapper/ffgosdk/ff_go_sdk.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func (s SDK) GetVariant(flag *restapi.FlagCheckBody) (string, error) {
5151
t.Identifier = *flag.Target.TargetIdentifier
5252
}
5353
if flag.Target.TargetName != nil {
54-
t.Name = flag.Target.TargetName
54+
t.Name = *flag.Target.TargetName
5555
}
5656
attributes := map[string]interface{}{}
5757
if flag.Target.Attributes != nil {

0 commit comments

Comments
 (0)