Skip invalid reactions instead of crashing (#1227)

pull/1232/head
Oleksii Holub 7 months ago committed by GitHub
parent 886b8442d3
commit 9a5697b5b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -676,10 +676,14 @@ public class DiscordClient(string token)
.SetQueryParameter("after", currentAfter.ToString())
.Build();
var response = await GetJsonResponseAsync(url, cancellationToken);
// Can be null on reactions with an emoji that has been deleted (?)
// https://github.com/Tyrrrz/DiscordChatExporter/issues/1226
var response = await TryGetJsonResponseAsync(url, cancellationToken);
if (response is null)
yield break;
var count = 0;
foreach (var userJson in response.EnumerateArray())
foreach (var userJson in response.Value.EnumerateArray())
{
var user = User.Parse(userJson);
yield return user;

Loading…
Cancel
Save