Skip to content

Commit

Permalink
Handle null federated object gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
jbreeden-splunk committed Apr 3, 2020
1 parent ab61724 commit 7b23fa2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,16 @@ func executorFindInsertionPoints(resultLock *sync.Mutex, targetPoints []string,
// get the type of the object in question
selectionType := foundSelection.Definition.Type

if rootValue == nil {
if selectionType.NonNull {
err := fmt.Errorf("Received null for required field: %v", foundSelection.Name)
log.Warn(err)
return nil, err
} else {
return nil, nil
}
}

// if the type is a list
if selectionType.Elem != nil {
log.Debug("Selection should be a list")
Expand Down

0 comments on commit 7b23fa2

Please sign in to comment.