It's not a programming error if face->family is NULL or family->fontmap is
authorBehdad Esfahbod <behdad@gnome.org>
Sat, 31 Jan 2009 23:35:48 +0000 (23:35 +0000)
committerBehdad Esfahbod <behdad@src.gnome.org>
Sat, 31 Jan 2009 23:35:48 +0000 (23:35 +0000)
2009-01-31  Behdad Esfahbod  <behdad@gnome.org>

        * pango/pangofc-fontmap.c (pango_fc_face_describe),
        (pango_fc_face_list_sizes), (pango_fc_family_list_faces):
        It's not a programming error if face->family is NULL or
        family->fontmap is NULL.  Be graceful.

svn path=/trunk/; revision=2823

ChangeLog
pango/pangofc-fontmap.c

index 318b578..db1d522 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-01-31  Behdad Esfahbod  <behdad@gnome.org>
+
+       * pango/pangofc-fontmap.c (pango_fc_face_describe),
+       (pango_fc_face_list_sizes), (pango_fc_family_list_faces):
+       It's not a programming error if face->family is NULL or
+       family->fontmap is NULL.  Be graceful.
+
 2009-01-30  Behdad Esfahbod  <behdad@gnome.org>
 
        Bug 569763 – pango doesn't like font descriptions without family!
index 11cb676..491b912 100644 (file)
@@ -2050,7 +2050,8 @@ pango_fc_face_describe (PangoFontFace *face)
   FcPattern *match_pattern;
   FcPattern *result_pattern;
 
-  g_return_val_if_fail (fcfamily != NULL, NULL);
+  if (G_UNLIKELY (!fcfamily))
+    return pango_font_description_new ();
 
   if (fcface->fake)
     {
@@ -2121,8 +2122,8 @@ pango_fc_face_list_sizes (PangoFontFace  *face,
 
   *sizes = NULL;
   *n_sizes = 0;
-  g_return_if_fail (fcface->family != NULL);
-  g_return_if_fail (fcface->family->fontmap != NULL);
+  if (G_UNLIKELY (!fcface->family || !fcface->family->fontmap))
+    return;
 
   pattern = FcPatternCreate ();
   FcPatternAddString (pattern, FC_FAMILY, (FcChar8*)(void*)fcface->family->family_name);
@@ -2255,7 +2256,8 @@ pango_fc_family_list_faces (PangoFontFamily  *family,
 
   *faces = NULL;
   *n_faces = 0;
-  g_return_if_fail (fcfontmap != NULL);
+  if (G_UNLIKELY (!fcfontmap))
+    return;
 
   priv = fcfontmap->priv;