Skip to content

Commit 174c74b

Browse files
ars18wrwiText-CI
authored andcommitted
Prevent font comparison from throwing NPE.
By mistake we didn't check that family font name exists. DEVSIX-3389 Autoported commit. Original commit hash: [7797df7e1]
1 parent 165ba58 commit 174c74b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

itext/itext.layout/itext/layout/font/FontSelector.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ private static int CharacteristicsSimilarity(String fontFamily, FontCharacterist
193193
}
194194
if (!fontFamilySetByCharacteristics) {
195195
// if alias is set, fontInfo's descriptor should not be checked
196-
if (!"".Equals(fontFamily) && (null == fontInfo.GetAlias() && fontInfo.GetDescriptor().GetFamilyNameLowerCase
197-
().Equals(fontFamily) || (null != fontInfo.GetAlias() && fontInfo.GetAlias().ToLowerInvariant().Equals
198-
(fontFamily)))) {
196+
if (!"".Equals(fontFamily) && (null == fontInfo.GetAlias() && null != fontInfo.GetDescriptor().GetFamilyNameLowerCase
197+
() && fontInfo.GetDescriptor().GetFamilyNameLowerCase().Equals(fontFamily) || (null != fontInfo.GetAlias
198+
() && fontInfo.GetAlias().ToLowerInvariant().Equals(fontFamily)))) {
199199
score += FONT_FAMILY_EQUALS_AWARD;
200200
}
201201
else {

port-hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
96b8bfb82523ec28793f64d5aeb23807247c6b45
1+
7797df7e117620e8aa59c17afe07566ab8487f60

0 commit comments

Comments
 (0)