summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2022-04-03 15:53:34 -0400
committerMatthias Clasen <mclasen@redhat.com>2022-04-21 19:19:45 -0400
commitfeb3d3b274b4426963567c28b842e8dbf68999dd (patch)
treeec4216e27998edb491148cc71cf0e65e0b3682d2
parente191519d3078b1809f6a266ea2ea4f1ab924afdf (diff)
downloadgtk+-feb3d3b274b4426963567c28b842e8dbf68999dd.tar.gz
inspector: Avoid a crash
Attribute lists can be NULL, it turns out.
-rw-r--r--gtk/inspector/prop-editor.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gtk/inspector/prop-editor.c b/gtk/inspector/prop-editor.c
index db3d6f2c1b..05048f5472 100644
--- a/gtk/inspector/prop-editor.c
+++ b/gtk/inspector/prop-editor.c
@@ -405,7 +405,7 @@ attr_list_changed (GObject *object, GParamSpec *pspec, gpointer data)
{
GtkEntry *entry = GTK_ENTRY (data);
GValue val = G_VALUE_INIT;
- char *str;
+ char *str = NULL;
const char *text;
PangoAttrList *attrs;
@@ -413,7 +413,8 @@ attr_list_changed (GObject *object, GParamSpec *pspec, gpointer data)
get_property_value (object, pspec, &val);
attrs = g_value_get_boxed (&val);
- str = pango_attr_list_to_string (attrs);
+ if (attrs)
+ str = pango_attr_list_to_string (attrs);
if (str == NULL)
str = g_strdup ("");
text = gtk_editable_get_text (GTK_EDITABLE (entry));