value: fix crash serialising a 0 flags value when there's no name for it

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
This commit is contained in:
Alban Browaeys 2012-08-28 07:39:50 +02:00 committed by Tim-Philipp Müller
parent 985bc911a2
commit 7bf7749c2b

View 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 */