tests/check/elements/alsa.c: Fix test case: don't try to free NULL GValueArray when...
authorTim-Philipp Müller <tim@centricular.net>
Thu, 18 May 2006 20:30:26 +0000 (20:30 +0000)
committerTim-Philipp Müller <tim@centricular.net>
Thu, 18 May 2006 20:30:26 +0000 (20:30 +0000)
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.

ChangeLog
common
tests/check/elements/alsa.c

index 9c305ab..3f31e4d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 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:
        * tests/check/elements/alsa.c: (test_device_property_probe),
        (alsa_suite), (main):
diff --git a/common b/common
index a5b6630..6811863 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit a5b66304e7abe1440a0f8b0ed232ffbc56e8f3de
+Subproject commit 6811863fce665ce0a466bc03ee2ac5e2d5f47d28
index 92ec86b..1e93ae1 100644 (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");
-
-    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));
-
-      GST_LOG_OBJECT (element, "device[%d] = %s", i, g_value_get_string (val));
+    if (arr) {
+      for (i = 0; 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));
+
+        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);
   }