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.
This commit is contained in:
Brian Cameron 2003-07-25 14:31:15 +00:00
parent 13c11bbedf
commit 09c6aaa2f8

View file

@ -252,7 +252,7 @@ print_element_properties (GstElement *element)
GParamSpec **property_specs; GParamSpec **property_specs;
gint num_properties,i; gint num_properties,i;
gboolean readable; gboolean readable;
const char *string_val;
property_specs = g_object_class_list_properties property_specs = g_object_class_list_properties
(G_OBJECT_GET_CLASS (element), &num_properties); (G_OBJECT_GET_CLASS (element), &num_properties);
@ -274,8 +274,14 @@ print_element_properties (GstElement *element)
switch (G_VALUE_TYPE (&value)) { switch (G_VALUE_TYPE (&value)) {
case G_TYPE_STRING: case G_TYPE_STRING:
string_val = g_value_get_string (&value);
g_print ("%-23.23s String. ", ""); 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; break;
case G_TYPE_BOOLEAN: case G_TYPE_BOOLEAN:
g_print ("%-23.23s Boolean. ", ""); g_print ("%-23.23s Boolean. ", "");