Fixed bug when checking FreeType2 version if it is not installed

This commit is contained in:
Andrew Murray 2021-04-27 08:12:45 +10:00
parent ef9a8e5f7f
commit ca3ad49de3

View File

@ -170,8 +170,10 @@ class FreeTypeFont:
except ImportError:
pass
else:
freetype_version = parse_version(features.version_module("freetype2"))
if freetype_version < parse_version("2.8"):
freetype_version = features.version_module("freetype2")
if freetype_version is not None and parse_version(
freetype_version
) < parse_version("2.8"):
warnings.warn(
"Support for FreeType 2.7 is deprecated and will be removed"
" in Pillow 9 (2022-01-02). Please upgrade to FreeType 2.8 "