gst/gstvalue.c: Don't crash if either of the string GValues is empty.

Original commit message from CVS:
* gst/gstvalue.c:
Don't crash if either of the string GValues is empty.
This commit is contained in:
Stefan Kost 2008-11-17 21:25:39 +00:00
parent de6f88f0f0
commit d27aea0391
2 changed files with 15 additions and 6 deletions

View file

@ -1,3 +1,8 @@
2008-11-17 Stefan Kost <ensonic@users.sf.net>
* gst/gstvalue.c:
Don't crash if either of the string GValues is empty.
2008-11-17 Andy Wingo <wingo@pobox.com> 2008-11-17 Andy Wingo <wingo@pobox.com>
* tools/gst-inspect.c (print_all_uri_handlers): New function, * tools/gst-inspect.c (print_all_uri_handlers): New function,

View file

@ -1764,6 +1764,9 @@ gst_value_deserialize_float (GValue * dest, const gchar * s)
static gint static gint
gst_value_compare_string (const GValue * value1, const GValue * value2) gst_value_compare_string (const GValue * value1, const GValue * value2)
{ {
if (!value1->data[0].v_pointer || !value2->data[0].v_pointer) {
return GST_VALUE_UNORDERED;
} else {
int x = strcmp (value1->data[0].v_pointer, value2->data[0].v_pointer); int x = strcmp (value1->data[0].v_pointer, value2->data[0].v_pointer);
if (x < 0) if (x < 0)
@ -1772,6 +1775,7 @@ gst_value_compare_string (const GValue * value1, const GValue * value2)
return GST_VALUE_GREATER_THAN; return GST_VALUE_GREATER_THAN;
return GST_VALUE_EQUAL; return GST_VALUE_EQUAL;
} }
}
/* keep in sync with gststructure.c */ /* keep in sync with gststructure.c */
#define GST_ASCII_IS_STRING(c) (g_ascii_isalnum((c)) || ((c) == '_') || \ #define GST_ASCII_IS_STRING(c) (g_ascii_isalnum((c)) || ((c) == '_') || \