value: fix crash serialising a 0 flags value when there's no name for it
authorAlban Browaeys <prahal@yahoo.com>
Tue, 28 Aug 2012 05:39:50 +0000 (07:39 +0200)
committerTim-Philipp Müller <tim@centricular.net>
Wed, 29 Aug 2012 17:59:21 +0000 (18:59 +0100)
Fixes segfault when doing gst-launch-1.0 -v -m camerabin
(encodebin notifies a 0 value for its "flag" property).

https://bugzilla.gnome.org/show_bug.cgi?id=682958

gst/gstvalue.c

index 644f21e..997a5e1 100644 (file)
@@ -2847,7 +2847,10 @@ gst_value_serialize_flags (const GValue * value)
   /* if no flags are set, try to serialize to the _NONE string */
   if (!flags) {
     fl = g_flags_get_first_value (klass, flags);
-    return g_strdup (fl->value_name);
+    if (fl)
+      return g_strdup (fl->value_name);
+    else
+      return g_strdup ("0");
   }
 
   /* some flags are set, so serialize one by one */