From acff474a2b27b6224d9716a7f6d642b92691d6a8 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 12 Apr 2024 21:32:05 +0200 Subject: [PATCH] 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.5 Fixes: QTBUG-123839 Change-Id: Ie01e9f75f025650b0802736bb589ebdc48e93696 Reviewed-by: Volker Hilsheimer (cherry picked from commit b773a4f5836b39e363899ad48a9f469e7f18db1a) Reviewed-by: Qt Cherry-pick Bot --- src/widgets/styles/qstylesheetstyle.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 7602217f24c..655b2246176 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -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(context)) { if (QScreen *screen = QApplication::screenAt(widget->mapToGlobal(QPoint(0, 0))))