Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Merge pull request #780 from jeschu1/nullref2
Browse files Browse the repository at this point in the history
devops: don't null ref when ContentType is null
  • Loading branch information
jeschu1 authored Oct 9, 2018
2 parents 906745d + 81fd82d commit f58ec17
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Microsoft.Alm.Authentication/Src/Network.cs
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ public async Task SetContent(HttpContent content)
if (content is null)
throw new ArgumentNullException(nameof(content));

if (content.Headers.ContentType.MediaType != null
if (content.Headers.ContentType?.MediaType != null
&& (content.Headers.ContentType.MediaType.StartsWith("text/", StringComparison.OrdinalIgnoreCase)
|| content.Headers.ContentType.MediaType.EndsWith("/json", StringComparison.OrdinalIgnoreCase)))
{
Expand Down Expand Up @@ -755,7 +755,7 @@ public async Task SetContent(HttpContent content)

lock (_syncpoint)
{
_mediaType = content.Headers.ContentType.MediaType;
_mediaType = content.Headers.ContentType?.MediaType;
_byteArray = asBytes;
}
}
Expand Down

0 comments on commit f58ec17

Please sign in to comment.