Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
Quick 404 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lay295 committed Feb 18, 2021
1 parent 4b8cf3a commit 2d73c9e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions TwitchDownloaderCore/TwitchHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -418,17 +418,19 @@ public static List<ChatBadge> GetChatBadges(int streamerId)
JProperty jVersionProperty = version.ToObject<JProperty>();
string versionString = jVersionProperty.Name;
string downloadUrl = version.First["image_url_2x"].ToString();
byte[] bytes = client.DownloadData(downloadUrl);
MemoryStream ms = new MemoryStream(bytes);
try
{
byte[] bytes = client.DownloadData(downloadUrl);
MemoryStream ms = new MemoryStream(bytes);
//For some reason, twitch has corrupted images sometimes :) for example
//https://static-cdn.jtvnw.net/badges/v1/a9811799-dce3-475f-8feb-3745ad12b7ea/1
SKBitmap badgeImage = SKBitmap.Decode(ms);
versions.Add(versionString, badgeImage);
}
catch (ArgumentException)
{ }
catch (WebException)
{ }
}

chatBadges.Add(new ChatBadge() { Name = name, Versions = versions });
Expand Down

0 comments on commit 2d73c9e

Please sign in to comment.