QStyleSheetStyle: Don't try to load a pixmap with an empty filename

QStyleSheetStyle::loadPixmap() might be called with an empty filename
but then it should not try to load a file with an empty filename.

Pick-to: 6.7 6.5
Fixes: QTBUG-123839
Change-Id: Ie01e9f75f025650b0802736bb589ebdc48e93696
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Christian Ehrlicher 2024-04-12 21:32:05 +02:00
parent f371f8a64d
commit b773a4f583

View File

@ -6512,6 +6512,9 @@ bool QStyleSheetStyle::isNaturalChild(const QObject *obj)
QPixmap QStyleSheetStyle::loadPixmap(const QString &fileName, const QObject *context)
{
if (fileName.isEmpty())
return {};
qreal ratio = -1.0;
if (const QWidget *widget = qobject_cast<const QWidget *>(context)) {
if (QScreen *screen = QApplication::screenAt(widget->mapToGlobal(QPoint(0, 0))))