Check that the FT_Face actually exists in SkTypeface_FreeType::onGetVariationDesignPo...
authorBen Wagner <bungeman@google.com>
Thu, 2 Mar 2017 16:48:38 +0000 (11:48 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Thu, 2 Mar 2017 17:32:13 +0000 (17:32 +0000)
All users of AutoFTAccess check the FT_Face for nullptr in case the
FT_Face cannot actually be created. This check was overlooked in the
recent addition of SkTypeface_FreeType::onGetVariationDesignPosition.

BUG=chromium:697878

Change-Id: I92dfe845f2aecfa00bd4d088ac139f74c019c03d
Reviewed-on: https://skia-review.googlesource.com/9151
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>

src/ports/SkFontHost_FreeType.cpp

index c7bc07aa4bff107fa4dfc3e1a3bda9be079f126f..1c228eaf48a6ed8447228d7959b4f890d69d84e4 100644 (file)
@@ -1581,7 +1581,7 @@ int SkTypeface_FreeType::onGetVariationDesignPosition(
     AutoFTAccess fta(this);
     FT_Face face = fta.face();
 
-    if (!(face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS)) {
+    if (!face || !(face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS)) {
         return 0;
     }