]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gstreamer0-10.git/commitdiff
gst/gstvalue.c: Don't crash if either of the string GValues is empty.
authorStefan Kost <ensonic@users.sourceforge.net>
Mon, 17 Nov 2008 21:25:39 +0000 (21:25 +0000)
committerStefan Kost <ensonic@users.sourceforge.net>
Mon, 17 Nov 2008 21:25:39 +0000 (21:25 +0000)
Original commit message from CVS:
* gst/gstvalue.c:
Don't crash if either of the string GValues is empty.

ChangeLog
gst/gstvalue.c

index 6c4bd89f399a91cc9656c3b7c1f88b3ce61d3ae2..d479772e804b0d7bc3511676056068871b2b52fb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * tools/gst-inspect.c (print_all_uri_handlers): New function,
index 66b27463eebe467f9351f7e75e0525f2e2ce9bf9..0e4322de86ae4f8bfe13efa4df93870a0decc102 100644 (file)
@@ -1764,13 +1764,17 @@ gst_value_deserialize_float (GValue * dest, const gchar * s)
 static gint
 gst_value_compare_string (const GValue * value1, const GValue * value2)
 {
-  int x = strcmp (value1->data[0].v_pointer, value2->data[0].v_pointer);
+  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);
 
-  if (x < 0)
-    return GST_VALUE_LESS_THAN;
-  if (x > 0)
-    return GST_VALUE_GREATER_THAN;
-  return GST_VALUE_EQUAL;
+    if (x < 0)
+      return GST_VALUE_LESS_THAN;
+    if (x > 0)
+      return GST_VALUE_GREATER_THAN;
+    return GST_VALUE_EQUAL;
+  }
 }
 
 /* keep in sync with gststructure.c */