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

Fix null reference access when ContentType is null #2501

Merged
merged 1 commit into from
Jul 21, 2022
Merged

Fix null reference access when ContentType is null #2501

merged 1 commit into from
Jul 21, 2022

Conversation

diogorolo
Copy link
Contributor

When we receive an ApiException and the ContentType is null, if we try to log the message (or otherwise call the ToString method), we're throwing an NullReferenceException because HttpResponseBodySafe is accessing ContentType without checking if it's null.

Copy link
Contributor

@nickfloyd nickfloyd left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the test as well ❤️

@nickfloyd nickfloyd merged commit 4f4ef5b into octokit:main Jul 21, 2022
@nickfloyd
Copy link
Contributor

release_notes: Prevents a null reference exception when ContentType is null on ApiException

@nickfloyd nickfloyd added Type: Bug Something isn't working as documented and removed category: bug labels Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working as documented
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants