Skip to content

Commit bff4aba

Browse files
Merge pull request #24 from grafana/julienduchesne/missing-nil-check
Add missing nil check
2 parents 5e0063f + 0a6cf9f commit bff4aba

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/processing/find_field.go

+3
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ func FindRangesFromIndexList(stack *nodestack.NodeStack, indexList []string, vm
108108
switch fieldNode := foundField.Body.(type) {
109109
case *ast.Var:
110110
bind := FindBindByIdViaStack(stack, fieldNode.Id)
111+
if bind == nil {
112+
return nil, fmt.Errorf("could not find bind for %s", fieldNode.Id)
113+
}
111114
foundDesugaredObjects = append(foundDesugaredObjects, bind.Body.(*ast.DesugaredObject))
112115
case *ast.DesugaredObject:
113116
stack = stack.Push(fieldNode)

0 commit comments

Comments
 (0)