Windows: Fix potential crash in font database when family name is empty.

Task-number: QTBUG-36651

Change-Id: Icd3edc7dbed3e692b32374b0ab6251e7f939589d
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
Friedemann Kleint 2014-02-10 15:24:55 +01:00 committed by The Qt Project
parent ae4243df1e
commit db98d65415
2 changed files with 2 additions and 2 deletions

View File

@ -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;

View File

@ -130,7 +130,7 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet,
typedef QPair<QString, QStringList> 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("::"));