summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2022-01-25 20:49:25 -0500
committerMatthias Clasen <mclasen@redhat.com>2022-01-25 20:49:25 -0500
commit48ba0b8c7a34ec7b2ef8934a9d6697c2c7f6867d (patch)
tree840396bed1d53c38068326e1998bc517b142ed88
parent4c9d3a2222b3921d3c6ed5eabd0d8a90f458ffed (diff)
downloadpango-48ba0b8c7a34ec7b2ef8934a9d6697c2c7f6867d.tar.gz
attributes: Handle custom attributes
We should not segfault when printing a PangoAttrList containing some attributes that have been registered by gtk.
-rw-r--r--pango/pango-attributes.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index 6f50d3fe..8d93e5ab 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -2610,7 +2610,10 @@ get_attr_type_nick (PangoAttrType attr_type)
enum_value = g_enum_get_value (enum_class, attr_type);
g_type_class_unref (enum_class);
- return enum_value->value_nick;
+ if (enum_value)
+ return enum_value->value_nick;
+ else
+ return pango_attr_type_get_name (attr_type);
}
static GType
@@ -2716,6 +2719,10 @@ attr_print (GString *str,
g_string_append_printf (str, " %d", size->size);
else if ((features = pango_attribute_as_font_features (attr)) != NULL)
g_string_append_printf (str, " \"%s\"", features->features);
+ else if (pango_attr_type_get_name (attr->klass->type))
+ {
+ g_string_append (str, "NONE");
+ }
else
{
g_warning ("Unhandled attribute type %s (%d)\n",