[UserList] Prevent failed loads from poisoning the banner card art cache

This commit is contained in:
Lukas Brübach 2026-08-16 02:51:22 +02:00
parent d99798111e
commit 3821494572

View file

@ -39,7 +39,10 @@ void UserCardArtProvider::requestCardArt(const QString &userName, const QString
const QString key = makeKey(userName, cardName, providerId);
if (cardArtCache.contains(key) || pending.contains(key)) {
if (pending.contains(key)) {
return;
}
if (cardArtCache.contains(key) && !cardArtCache.value(key).isNull()) {
return;
}
@ -63,6 +66,10 @@ QPixmap UserCardArtProvider::cropCardArt(const QPixmap &fullRes)
void UserCardArtProvider::insertIntoCache(const QString &key, const QPixmap &pixmap)
{
if (pixmap.isNull()) {
return;
}
if (!cardArtCache.contains(key)) {
cacheInsertionOrder.append(key);
while (cacheInsertionOrder.size() > MaxCacheEntries) {
@ -129,8 +136,6 @@ void UserCardArtProvider::processQueue()
if (!fullRes.isNull()) {
self->insertIntoCache(key, self->cropCardArt(fullRes));
} else {
self->insertIntoCache(key, QPixmap());
}
self->pending.remove(key);