summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2010-04-23 19:59:53 -0400
committerBehdad Esfahbod <behdad@behdad.org>2010-04-23 19:59:53 -0400
commitd6b3c83a90f60bedb4049750ffb351161710980d (patch)
treed535a6586703730b42b2e223203bbe861ab485f9
parentad3653751b1e4a03f7058200cb83f64db46722d5 (diff)
Allow get_table() to return NULL
-rw-r--r--src/hb-font.cc6
-rw-r--r--src/hb-ft.c2
2 files changed, 6 insertions, 2 deletions
diff --git a/src/hb-font.cc b/src/hb-font.cc
index 4fdb569..f913f7e 100644
--- a/src/hb-font.cc
+++ b/src/hb-font.cc
@@ -324,10 +324,14 @@ hb_blob_t *
hb_face_get_table (hb_face_t *face,
hb_tag_t tag)
{
+ hb_blob_t *blob;
+
if (HB_UNLIKELY (!face || !face->get_table))
return hb_blob_create_empty ();
- return face->get_table (tag, face->user_data);
+ blob = face->get_table (tag, face->user_data);
+
+ return blob? blob : hb_blob_create_empty ();
}
diff --git a/src/hb-ft.c b/src/hb-ft.c
index b5dd657..3e91eff 100644
--- a/src/hb-ft.c
+++ b/src/hb-ft.c
@@ -159,7 +159,7 @@ _get_table (hb_tag_t tag, void *user_data)
/* TODO Use FT_Memory? */
buffer = malloc (length);
if (buffer == NULL)
- return hb_blob_create_empty ();
+ return NULL;
error = FT_Load_Sfnt_Table (ft_face, tag, 0, buffer, &length);
if (error)