summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-09-20 10:39:24 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-09-20 10:59:37 -0400
commit3c62cd90d4cd345058f391b77cc0c08e290ef636 (patch)
tree8ada74447f961a09c91b79bc3bd3481b9b182abd
parent81793b62d82d06d17f91c05c88f8835cfbff6dc9 (diff)
downloadgtk+-3c62cd90d4cd345058f391b77cc0c08e290ef636.tar.gz
fontchooser: Handle families without faces
This might seem useless, but I've met fonts where pango_font_family_get_face (family, NULL) return NULL. Handle it without criticals.
-rw-r--r--gtk/gtkfontchooserwidget.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c
index 0f380f34b9..171ef5c820 100644
--- a/gtk/gtkfontchooserwidget.c
+++ b/gtk/gtkfontchooserwidget.c
@@ -738,10 +738,13 @@ get_font_attributes (GObject *ignore,
face = pango_font_family_get_face (item, NULL);
else
face = item;
- font_desc = pango_font_face_describe (face);
- attribute = pango_attr_font_desc_new (font_desc);
- pango_attr_list_insert (attrs, attribute);
- pango_font_description_free (font_desc);
+ if (face)
+ {
+ font_desc = pango_font_face_describe (face);
+ attribute = pango_attr_font_desc_new (font_desc);
+ pango_attr_list_insert (attrs, attribute);
+ pango_font_description_free (font_desc);
+ }
}
return attrs;
@@ -1044,6 +1047,9 @@ add_languages_from_font (GtkFontChooserWidget *self,
else
face = PANGO_FONT_FACE (item);
+ if (!face)
+ return;
+
desc = pango_font_face_describe (face);
pango_font_description_set_size (desc, 20);