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.
This commit is contained in:
Stefan Sauer 2015-01-04 23:24:53 +01:00
parent a4e561c7f8
commit 266481e9ff

View file

@ -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);