fix crash with skin format

fixes #4994
All the formats lower than Format_Indexed8 will have less information
and can't be used directly.
Also added the check for alphaChannel check just to be sure.

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2026-02-11 13:35:40 +02:00
parent 7cda5e738f
commit fe5aee2619
No known key found for this signature in database
GPG key ID: 55EF5DA53DB36318

View file

@ -58,7 +58,7 @@ static QImage improveSkin(QImage skin)
// It seems some older skins may use this format, which can't be drawn onto
// https://github.com/PrismLauncher/PrismLauncher/issues/4032
// https://doc.qt.io/qt-6/qpainter.html#begin
if (skin.format() == QImage::Format_Indexed8) {
if (skin.format() <= QImage::Format_Indexed8 || !skin.hasAlphaChannel()) {
skin = skin.convertToFormat(QImage::Format_ARGB32);
}