Skip to content

Commit

Permalink
Fix potential NullReferenceException
Browse files Browse the repository at this point in the history
  • Loading branch information
ScrubN committed Jan 12, 2024
1 parent 1b2d250 commit c600d48
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion TwitchDownloaderCore/TwitchHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ public static async Task<GqlClipTokenResponse[]> GetClipLinks(string clipId)
response.EnsureSuccessStatusCode();

var gqlClipTokenResponses = await response.Content.ReadFromJsonAsync<GqlClipTokenResponse[]>();
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;
}

Expand Down

0 comments on commit c600d48

Please sign in to comment.