Commit 4e0c9ee155caa181072d90573bd3e4b2693f32ce

suzuki toshiya 2009-09-24T14:30:40

[cache] Check the face filled by FTC_Manager_LookupFace().

diff --git a/ChangeLog b/ChangeLog
index 683dfcb..a3e006b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-09-24  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+	[cache] Check the face filled by FTC_Manager_LookupFace().
+
+	* src/cache/ftcbasic.c (ftc_basic_family_get_count): Return
+	immediately if FTC_Manager_LookupFace() fills face by NULL.
+	Such case can occur when the code is optimized by GCC-4.2.x.
+
 2009-09-23  Werner Lemberg  <wl@gnu.org>
 
 	* docs/CHANGES: Updated.
diff --git a/src/cache/ftcbasic.c b/src/cache/ftcbasic.c
index e329d31..32e6b43 100644
--- a/src/cache/ftcbasic.c
+++ b/src/cache/ftcbasic.c
@@ -142,6 +142,9 @@
     error = FTC_Manager_LookupFace( manager, family->attrs.scaler.face_id,
                                     &face );
 
+    if ( error || !face )
+      return result;
+
     if ( (FT_ULong)face->num_glyphs > FT_UINT_MAX || 0 > face->num_glyphs )
     {
       FT_TRACE1(( "ftc_basic_family_get_count: too large number of glyphs " ));