Skip to content

Commit

Permalink
Update AvatarUtility.cs
Browse files Browse the repository at this point in the history
Move to coalasce
  • Loading branch information
nikita-petko committed Jul 3, 2024
1 parent ae60bbd commit 390a7e0
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,7 @@ private static string DownloadFile(string url)
var file = File.OpenWrite(path);

using var client = new HttpClient();
using var stream = client.GetStreamAsync(url).SyncOrDefault();

if (stream == null) throw new ThumbnailResponseException(ThumbnailResponseState.Error, "The thumbnail response stream was null");

using var stream = client.GetStreamAsync(url).SyncOrDefault() ?? throw new ThumbnailResponseException(ThumbnailResponseState.Error, "The thumbnail response stream was null");
stream.CopyTo(file);

file.Close();
Expand Down

0 comments on commit 390a7e0

Please sign in to comment.