Skip to content

Commit

Permalink
Fixed graphql.GetInitPayload panic if payload is nil.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gisle Martin Aune committed Sep 20, 2018
1 parent 380828f commit 575f28e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion graphql/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,5 +240,10 @@ func WithInitPayload(ctx context.Context, payload InitPayload) context.Context {

// GetInitPayload gets the payload from context.
func GetInitPayload(ctx context.Context) InitPayload {
return ctx.Value(initpayload).(InitPayload)
payload, ok := ctx.Value(initpayload).(InitPayload)
if !ok {
return nil
}

return payload
}

0 comments on commit 575f28e

Please sign in to comment.