From 3928cc95784129a5560290deb7c8c64a21dfaa45 Mon Sep 17 00:00:00 2001 From: pajlada Date: Sat, 2 Mar 2024 12:05:12 +0100 Subject: [PATCH] fix: correctly load twitch badges in highlights page (#5223) --- CHANGELOG.md | 1 + src/providers/twitch/TwitchBadges.cpp | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8184d5c..5e4507ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/src/providers/twitch/TwitchBadges.cpp b/src/providers/twitch/TwitchBadges.cpp index 4d3f8511..14c7475e 100644 --- a/src/providers/twitch/TwitchBadges.cpp +++ b/src/providers/twitch/TwitchBadges.cpp @@ -242,10 +242,11 @@ void TwitchBadges::getBadgeIcons(const QList &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; }