tests/check/elements/alsa.c: Fix test case: don't try to free NULL GValueArray when there are no devices.

Original commit message from CVS:
* tests/check/elements/alsa.c: (test_device_property_probe):
Fix test case: don't try to free NULL GValueArray when there
are no devices.
This commit is contained in:
Tim-Philipp Müller 2006-05-18 20:30:26 +00:00
parent da8a3c9b07
commit d41ffcb767
3 changed files with 19 additions and 9 deletions

View file

@ -1,3 +1,9 @@
2006-05-18 Tim-Philipp Müller <tim at centricular dot net>
* tests/check/elements/alsa.c: (test_device_property_probe):
Fix test case: don't try to free NULL GValueArray when there
are no devices.
2006-05-18 Tim-Philipp Müller <tim at centricular dot net>
* tests/check/Makefile.am:

2
common

@ -1 +1 @@
Subproject commit a5b66304e7abe1440a0f8b0ed232ffbc56e8f3de
Subproject commit 6811863fce665ce0a466bc03ee2ac5e2d5f47d28

View file

@ -46,17 +46,21 @@ GST_START_TEST (test_device_property_probe)
fail_unless (probe != NULL);
arr = gst_property_probe_probe_and_get_values_name (probe, "device");
if (arr) {
for (i = 0; i < arr->n_values; ++i) {
GValue *val;
for (i = 0; arr != NULL && i < arr->n_values; ++i) {
GValue *val;
val = g_value_array_get_nth (arr, i);
fail_unless (val != NULL);
fail_unless (G_VALUE_HOLDS_STRING (val));
val = g_value_array_get_nth (arr, i);
fail_unless (val != NULL);
fail_unless (G_VALUE_HOLDS_STRING (val));
GST_LOG_OBJECT (element, "device[%d] = %s", i, g_value_get_string (val));
GST_LOG_OBJECT (element, "device[%d] = %s", i,
g_value_get_string (val));
}
g_value_array_free (arr);
} else {
GST_LOG_OBJECT (element, "no devices found");
}
g_value_array_free (arr);
gst_object_unref (element);
}