From 139d0cccb71a6a7a54cd2fa778170c34dbba44fb Mon Sep 17 00:00:00 2001 From: ScrubN <72096833+ScrubN@users.noreply.github.com> Date: Tue, 19 Dec 2023 02:26:28 -0500 Subject: [PATCH] Fix chat/video download crash due to VOD chapter response containing a null object --- TwitchDownloaderCore/TwitchHelper.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/TwitchDownloaderCore/TwitchHelper.cs b/TwitchDownloaderCore/TwitchHelper.cs index 1b2f9b40..9604320c 100644 --- a/TwitchDownloaderCore/TwitchHelper.cs +++ b/TwitchDownloaderCore/TwitchHelper.cs @@ -930,7 +930,13 @@ public static async Task GetVideoChapters(int videoId) request.Headers.Add("Client-ID", "kimne78kx3ncx6brgo4mv6wki5h1ko"); using var response = await httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead); response.EnsureSuccessStatusCode(); - return await response.Content.ReadFromJsonAsync(); + + var chapterResponse = await response.Content.ReadFromJsonAsync(); + chapterResponse.data.video.moments ??= new VideoMomentConnection + { + edges = new List() + }; + return chapterResponse; } public static async Task GetOrGenerateVideoChapters(int videoId, VideoInfo videoInfo)