From 963267643e3b3100118a888aa76b9de1d1b8fbd6 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Fri, 17 Feb 2012 15:07:56 -0800 Subject: [PATCH] gstvalue: Gracefully handle NULL Gvalue Avoids unreferencing NULL pointer --- gst/gstvalue.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gst/gstvalue.c b/gst/gstvalue.c index 966293a..1ffe441 100644 --- a/gst/gstvalue.c +++ b/gst/gstvalue.c @@ -299,6 +299,9 @@ gst_value_lcopy_list_or_array (const GValue * value, guint n_collect_values, static gboolean gst_value_list_or_array_get_basic_type (const GValue * value, GType * type) { + if (G_UNLIKELY (value == NULL)) + return FALSE; + if (GST_VALUE_HOLDS_LIST (value)) { if (VALUE_LIST_SIZE (value) == 0) return FALSE; @@ -312,7 +315,9 @@ gst_value_list_or_array_get_basic_type (const GValue * value, GType * type) return gst_value_list_or_array_get_basic_type (&g_array_index (array, GValue, 0), type); } + *type = G_VALUE_TYPE (value); + return TRUE; } -- 2.7.4