From 390a7e0d114ada10c536927f567ad26f660e8b3a Mon Sep 17 00:00:00 2001 From: Nikita Petko Date: Wed, 3 Jul 2024 14:07:25 +0100 Subject: [PATCH] Update AvatarUtility.cs Move to coalasce --- .../grid-bot/lib/utility/Implementation/AvatarUtility.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/services/grid-bot/lib/utility/Implementation/AvatarUtility.cs b/services/grid-bot/lib/utility/Implementation/AvatarUtility.cs index 93cb9fbc..5c4b634f 100644 --- a/services/grid-bot/lib/utility/Implementation/AvatarUtility.cs +++ b/services/grid-bot/lib/utility/Implementation/AvatarUtility.cs @@ -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();