diff options
author | Andy Shaw <andy.shaw@qt.io> | 2020-11-25 13:42:22 +0100 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2020-11-27 08:28:26 +0100 |
commit | 420e27c9efc1ef1a6400dc287345e897036abc71 (patch) | |
tree | 959865c804563dcb2c89d8eb81599e1494b98026 /src/gui | |
parent | c7a335817e909951bfd142018f855645b4a46168 (diff) |
Return an empty QStringList if the family string is empty
Since doing a split will create an empty entry, then we can save time
and just return an empty QStringList in this case
Change-Id: I86a6532e7243151493ea4021bfcc05e4c2a9cbf0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/text/qfont.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 43dccb1ded..aa03d814be 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -206,6 +206,8 @@ static int convertWeights(int weight, bool inverted) static QStringList splitIntoFamilies(const QString &family) { QStringList familyList; + if (family.isEmpty()) + return familyList; const auto list = QStringView{family}.split(QLatin1Char(',')); const int numFamilies = list.size(); familyList.reserve(numFamilies); |