Skip to content

Commit

Permalink
Bug 1757897 - Add null-check for charmap in FT_Face, before trying to…
Browse files Browse the repository at this point in the history
… check for symbol encoding. r=lsalzman

We need a null-check here in case FT_Select_Charmap failed to find any usable charmap in the font
(e.g. maybe an old font with only a MacRoman charmap, but no Unicode or Symbol table).

Differential Revision: https://phabricator.services.mozilla.com/D140179
  • Loading branch information
jfkthame committed Mar 3, 2022
1 parent 1462303 commit 2c3e454
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gfx/thebes/gfxFT2Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ uint32_t gfxFT2LockedFace::GetGlyph(uint32_t aCharCode) {
#else
uint32_t gid = FT_Get_Char_Index(mFace, aCharCode);
#endif
if (!gid && mFace->charmap->encoding == FT_ENCODING_MS_SYMBOL) {
if (!gid && mFace->charmap &&
mFace->charmap->encoding == FT_ENCODING_MS_SYMBOL) {
if (auto pua = gfxFontUtils::MapLegacySymbolFontCharToPUA(aCharCode)) {
gid = FT_Get_Char_Index(mFace, pua);
}
Expand Down

0 comments on commit 2c3e454

Please sign in to comment.