diff --git a/gst/gstvalue.c b/gst/gstvalue.c index d18e9cec0b..2c28214b67 100644 --- a/gst/gstvalue.c +++ b/gst/gstvalue.c @@ -1206,11 +1206,11 @@ gst_value_compare_g_value_array (const GValue * value1, const GValue * value2) guint i; GValueArray *array1 = value1->data[0].v_pointer; GValueArray *array2 = value2->data[0].v_pointer; - guint len = array1->n_values; + guint len = array1 ? array1->n_values : 0; GValue *v1; GValue *v2; - if (len != array2->n_values) + if (len != (array2 ? array2->n_values : 0)) return GST_VALUE_UNORDERED; for (i = 0; i < len; i++) { diff --git a/tests/check/gst/gstvalue.c b/tests/check/gst/gstvalue.c index adbcc2e4b4..707251b131 100644 --- a/tests/check/gst/gstvalue.c +++ b/tests/check/gst/gstvalue.c @@ -1020,6 +1020,15 @@ GST_START_TEST (test_value_compare) g_value_unset (&value2); g_value_unset (&tmp); + g_value_init (&value1, G_TYPE_VALUE_ARRAY); + g_value_init (&value2, G_TYPE_VALUE_ARRAY); + + fail_unless (gst_value_compare (&value1, &value2) == GST_VALUE_EQUAL, + "Empty Value arrays aren't equals when they should"); + + g_value_unset (&value1); + g_value_unset (&value2); + g_value_init (&value1, GST_TYPE_BITMASK); gst_value_set_bitmask (&value1, 0x123); g_value_init (&value2, GST_TYPE_BITMASK);