fix nil pointer dereference (#13221)

This commit is contained in:
Mitsuhiro Tanda 2018-09-11 19:53:39 +09:00 committed by Torkel Ödegaard
parent 2936e34d75
commit 28250271cc

View File

@ -466,6 +466,9 @@ func (e *CloudWatchExecutor) handleGetEc2InstanceAttribute(ctx context.Context,
return nil, errors.New("invalid attribute path")
}
v = v.FieldByName(key)
if !v.IsValid() {
return nil, errors.New("invalid attribute path")
}
}
if attr, ok := v.Interface().(*string); ok {
data = *attr