Browse Source

fix nil pointer dereference (#13221)

Mitsuhiro Tanda 7 years ago
parent
commit
28250271cc
1 changed files with 3 additions and 0 deletions
  1. 3 0
      pkg/tsdb/cloudwatch/metric_find_query.go

+ 3 - 0
pkg/tsdb/cloudwatch/metric_find_query.go

@@ -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