From 09c6aaa2f862bc8e05cc467fb27ca85c67670568 Mon Sep 17 00:00:00 2001 From: Brian Cameron Date: Fri, 25 Jul 2003 14:31:15 +0000 Subject: [PATCH] Properly handle null string value, preventing core dump on Solaris. Original commit message from CVS: Properly handle null string value, preventing core dump on Solaris. --- tools/gst-inspect.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/gst-inspect.c b/tools/gst-inspect.c index 84699061b3..06ad8bb2b0 100644 --- a/tools/gst-inspect.c +++ b/tools/gst-inspect.c @@ -252,7 +252,7 @@ print_element_properties (GstElement *element) GParamSpec **property_specs; gint num_properties,i; gboolean readable; - + const char *string_val; property_specs = g_object_class_list_properties (G_OBJECT_GET_CLASS (element), &num_properties); @@ -274,8 +274,14 @@ print_element_properties (GstElement *element) switch (G_VALUE_TYPE (&value)) { case G_TYPE_STRING: + string_val = g_value_get_string (&value); g_print ("%-23.23s String. ", ""); - if (readable) g_print ("(Default \"%s\")", g_value_get_string (&value)); + if (readable) { + if (string_val == NULL) + g_print ("(Default \"\")"); + else + g_print ("(Default \"%s\")", g_value_get_string (&value)); + } break; case G_TYPE_BOOLEAN: g_print ("%-23.23s Boolean. ", "");