aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorflow <flowlnlnln@gmail.com>2022-11-15 12:07:11 -0300
committerflow <flowlnlnln@gmail.com>2022-11-15 12:07:11 -0300
commit7705f290ca69c0478f698ddf06a5f1edb731e8fc (patch)
tree41918dc2c47846f828d019ac791b5a06dc7ad8ce
parent074b53eb6b71f948ff30aca601103672c5c4c812 (diff)
downloadPrismLauncher-7705f290ca69c0478f698ddf06a5f1edb731e8fc.tar.gz
PrismLauncher-7705f290ca69c0478f698ddf06a5f1edb731e8fc.tar.bz2
PrismLauncher-7705f290ca69c0478f698ddf06a5f1edb731e8fc.zip
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>
-rw-r--r--launcher/minecraft/mod/ResourcePack.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/launcher/minecraft/mod/ResourcePack.cpp b/launcher/minecraft/mod/ResourcePack.cpp
index 3fc10a2f..b97bedf8 100644
--- a/launcher/minecraft/mod/ResourcePack.cpp
+++ b/launcher/minecraft/mod/ResourcePack.cpp
@@ -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)