Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid memory address or nil pointer dereference calling arg2map with f.Definition nil! #163

Open
frederikhors opened this issue Sep 5, 2021 · 1 comment

Comments

@frederikhors
Copy link

frederikhors commented Sep 5, 2021

Upgrading from github.com/vektah/gqlparser/v2 v2.1.0 to github.com/vektah/gqlparser/v2 v2.2.0 with the same generated ([email protected]) code and all the same files I get a monster error:

runtime error: invalid memory address or nil pointer dereference.

After a long time of debugging I realized the problem is here:

func (f *Field) ArgumentMap(vars map[string]interface{}) map[string]interface{} {
	return arg2map(f.Definition.Arguments, f.Arguments, vars)
}

f.Definition here is nil with v2.2.0, not with 2.1.0! Why?

How to fix this?

@frederikhors
Copy link
Author

The code is simple:

extend type Mutation {
  playerCreate(input: PlayerInput!): Player!
}

type Player {
  id: ID!
  firstname: String!
}

input PlayerInput {
  firstname: String!
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant