fix: don't retry to load RP images that can't fit in the cache

Avoids an infinite loop when the image is too big.

Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
flow 2022-11-15 12:07:11 -03:00
parent 074b53eb6b
commit 7705f290ca
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469

View File

@ -47,6 +47,12 @@ void ResourcePack::setImage(QImage new_image)
m_pack_image_cache_key.key = QPixmapCache::insert(QPixmap::fromImage(new_image));
m_pack_image_cache_key.was_ever_used = true;
// This can happen if the pixmap is too big to fit in the cache :c
if (!m_pack_image_cache_key.key.isValid()) {
qWarning() << "Could not insert a image cache entry! Ignoring it.";
m_pack_image_cache_key.was_ever_used = false;
}
}
QPixmap ResourcePack::image(QSize size)