Skip to content

Commit

Permalink
Fix ArgumentOutOfRangeException when loading information from chat fi…
Browse files Browse the repository at this point in the history
…les with less than 2 comments
  • Loading branch information
ScrubN committed Oct 15, 2023
1 parent f2daa67 commit c69f2d7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion TwitchDownloaderWPF/PageChatUpdate.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ private async void btnBrowse_Click(object sender, RoutedEventArgs e)
try
{
ChatJsonInfo = await ChatJson.DeserializeAsync(InputFile, true, false, CancellationToken.None);
ChatJsonInfo.comments.RemoveRange(1, ChatJsonInfo.comments.Count - 2);
if (ChatJsonInfo.comments.Count > 2)
{
ChatJsonInfo.comments.RemoveRange(1, ChatJsonInfo.comments.Count - 2);
}
GC.Collect();
}
catch (Exception ex)
Expand Down

0 comments on commit c69f2d7

Please sign in to comment.