fix: correctly load twitch badges in highlights page (#5223)

This commit is contained in:
pajlada 2024-03-02 12:05:12 +01:00 committed by GitHub
parent c1fa51242f
commit 3928cc9578
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 7 deletions

View file

@ -59,6 +59,7 @@
- Bugfix: Fixed issue on Windows preventing the title bar from being dragged in the top left corner. (#4873)
- Bugfix: Fixed an issue where reply context didn't render correctly if an emoji was touching text. (#4875, #4977, #5174)
- Bugfix: Fixed the input completion popup from disappearing when clicking on it on Windows and macOS. (#4876)
- Bugfix: Fixed Twitch badges not loading correctly in the badge highlighting setting page. (#5223)
- Bugfix: Fixed double-click text selection moving its position with each new message. (#4898)
- Bugfix: Fixed an issue where notifications on Windows would contain no or an old avatar. (#4899)
- Bugfix: Fixed headers of tables in the settings switching to bold text when selected. (#4913)

View file

@ -242,10 +242,11 @@ void TwitchBadges::getBadgeIcons(const QList<DisplayBadge> &badges,
void TwitchBadges::loadEmoteImage(const QString &name, ImagePtr image,
BadgeIconCallback &&callback)
{
NetworkRequest(image->url().string)
auto url = image->url().string;
NetworkRequest(url)
.concurrent()
.cache()
.onSuccess([this, name, callback](auto result) {
.onSuccess([this, name, callback, url](auto result) {
auto data = result.getData();
// const cast since we are only reading from it
@ -255,17 +256,18 @@ void TwitchBadges::loadEmoteImage(const QString &name, ImagePtr image,
if (!reader.canRead() || reader.size().isEmpty())
{
qCWarning(chatterinoTwitch)
<< "Can't read badge image at" << url << "for" << name
<< reader.errorString();
return;
}
QImage image = reader.read();
if (image.isNull())
{
return;
}
if (reader.imageCount() <= 0)
{
qCWarning(chatterinoTwitch)
<< "Failed reading badge image at" << url << "for" << name
<< reader.errorString();
return;
}