dwrite: Fix crash when loading unsupported font in QRawFont

When we tried loading an unsupported font, there was an unchecked
nullptr which caused crashes later.

This is a hotfix for 6.6 and older versions, as in Qt 6.7 it is
already part of 500be123f4fbb60593fe25d5fe70fbc62445e8aa.

Pick-to: 6.5 6.2 5.15
Fixes: QTBUG-123454
Change-Id: I954a39b5e26714b1cc197d2870e9caef87b0423e
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2024-03-19 10:55:33 +01:00
parent bb53c6705a
commit 282f30ab09

View File

@ -761,6 +761,9 @@ QFontEngine *QWindowsFontDatabaseBase::fontEngine(const QByteArray &fontData, qr
return nullptr;
IDWriteFontFace *directWriteFontFace = createDirectWriteFace(fontData);
if (directWriteFontFace == nullptr)
return nullptr;
fontEngine = new QWindowsFontEngineDirectWrite(directWriteFontFace,
pixelSize,
fontEngineData);