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

add nil check to z.credential #200

Merged
merged 1 commit into from
Feb 24, 2021
Merged

Conversation

goro9
Copy link
Contributor

@goro9 goro9 commented Feb 24, 2021

I had a problem when I wanted to authenticate using OAuth2 token as follows, so I dealt with it.

	ctx := context.Background()
	ts := oauth2.StaticTokenSource(
		&oauth2.Token{AccessToken: os.Getenv("ZENDESK_OAUTH2_TOKEN")},
	)
	tc := oauth2.NewClient(ctx, ts)

	z, _ := zendesk.NewClient(tc)

	ifz.SetSubdomain(os.Getenv("ZENDESK_SUBDOMAIN"))

	ticket, _ := z.GetTicket(ctx, int64(2))

got

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference

Please review.

@nukosuke nukosuke added the Bug Something isn't working label Feb 24, 2021
Copy link
Owner

@nukosuke nukosuke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@goro9
LGTM 👍
Thank you for reporting and sending patch for the bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants