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

Commit 81fd82d

Browse files
committed
devops: don't null ref when ContentType is null
1 parent 2c42ca6 commit 81fd82d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Microsoft.Alm.Authentication/Src/Network.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ public async Task SetContent(HttpContent content)
687687
if (content is null)
688688
throw new ArgumentNullException(nameof(content));
689689

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

756756
lock (_syncpoint)
757757
{
758-
_mediaType = content.Headers.ContentType.MediaType;
758+
_mediaType = content.Headers.ContentType?.MediaType;
759759
_byteArray = asBytes;
760760
}
761761
}

0 commit comments

Comments
 (0)