From db98d65415b270f49e015154a37a39befc8c752e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 10 Feb 2014 15:24:55 +0100 Subject: [PATCH] Windows: Fix potential crash in font database when family name is empty. Task-number: QTBUG-36651 Change-Id: Icd3edc7dbed3e692b32374b0ab6251e7f939589d Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowsfontdatabase.cpp | 2 +- src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 3bd24fdaab0..2fa08d30ced 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -841,7 +841,7 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet, int type) { // the "@family" fonts are just the same as "family". Ignore them. - if (familyName.at(0) == QLatin1Char('@') || familyName.startsWith(QStringLiteral("WST_"))) + if (familyName.isEmpty() || familyName.at(0) == QLatin1Char('@') || familyName.startsWith(QStringLiteral("WST_"))) return false; static const int SMOOTH_SCALABLE = 0xffff; diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp index c9160e4a75e..57a9077e5dd 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp @@ -130,7 +130,7 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet, typedef QPair FontKey; // the "@family" fonts are just the same as "family". Ignore them. - if (familyName.at(0) == QLatin1Char('@') || familyName.startsWith(QStringLiteral("WST_"))) + if (familyName.isEmpty() || familyName.at(0) == QLatin1Char('@') || familyName.startsWith(QStringLiteral("WST_"))) return false; const int separatorPos = familyName.indexOf(QStringLiteral("::"));