From 266481e9ff77392163d60297ebcfed4c2cf1b62e Mon Sep 17 00:00:00 2001 From: Stefan Sauer Date: Sun, 4 Jan 2015 23:24:53 +0100 Subject: [PATCH] preset: don't return empty preset lists Add a shortcut for the cases where an element implements the preset iface but has no presets and return NULL instead of an empty list in that case. --- gst/gstpreset.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gst/gstpreset.c b/gst/gstpreset.c index 6953508a06..ee5a4a5eb3 100644 --- a/gst/gstpreset.c +++ b/gst/gstpreset.c @@ -456,6 +456,12 @@ gst_preset_default_get_preset_names (GstPreset * preset) groups[num_groups] = NULL; } } + if (!num_groups) { + GST_INFO_OBJECT (preset, "Empty preset file"); + g_strfreev (groups); + return NULL; + } + /* sort the array now */ g_qsort_with_data (groups, num_groups, sizeof (gchar *), (GCompareDataFunc) strcmp, NULL);