[face] Return nil face if blob is inert
authorBehdad Esfahbod <behdad@behdad.org>
Mon, 2 May 2011 23:35:53 +0000 (19:35 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Mon, 2 May 2011 23:35:53 +0000 (19:35 -0400)
src/hb-font.cc

index 5e4d379..0a62fe3 100644 (file)
@@ -379,6 +379,9 @@ hb_face_t *
 hb_face_create_for_data (hb_blob_t    *blob,
                         unsigned int  index)
 {
+  if (unlikely (hb_object_is_inert (blob)))
+    return &_hb_face_nil;
+
   hb_face_for_data_closure_t *closure = _hb_face_for_data_closure_create (Sanitizer<OpenTypeFontFile>::sanitize (hb_blob_reference (blob)), index);
 
   if (unlikely (!closure))