From c600d485c224b1f3842aa6af8e104e7eb1c7c7d2 Mon Sep 17 00:00:00 2001 From: ScrubN <72096833+ScrubN@users.noreply.github.com> Date: Fri, 12 Jan 2024 16:37:52 -0500 Subject: [PATCH] Fix potential NullReferenceException --- TwitchDownloaderCore/TwitchHelper.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/TwitchDownloaderCore/TwitchHelper.cs b/TwitchDownloaderCore/TwitchHelper.cs index 3b53f25b..b73686a7 100644 --- a/TwitchDownloaderCore/TwitchHelper.cs +++ b/TwitchDownloaderCore/TwitchHelper.cs @@ -129,7 +129,11 @@ public static async Task GetClipLinks(string clipId) response.EnsureSuccessStatusCode(); var gqlClipTokenResponses = await response.Content.ReadFromJsonAsync(); - Array.Sort(gqlClipTokenResponses[0].data.clip.videoQualities, new ClipQualityComparer()); + if (gqlClipTokenResponses[0].data.clip.videoQualities is { Length: > 0}) + { + Array.Sort(gqlClipTokenResponses[0].data.clip.videoQualities, new ClipQualityComparer()); + } + return gqlClipTokenResponses; }