tests/examples/seek/seek.c: Don't crash when having no visualisations.
authorStefan Kost <ensonic@users.sourceforge.net>
Thu, 21 Aug 2008 11:20:36 +0000 (11:20 +0000)
committerStefan Kost <ensonic@users.sourceforge.net>
Thu, 21 Aug 2008 11:20:36 +0000 (11:20 +0000)
Original commit message from CVS:
* tests/examples/seek/seek.c:
Don't crash when having no visualisations.

ChangeLog
tests/examples/seek/seek.c

index cf8d48a..e05f1bd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-08-21  Stefan Kost  <ensonic@users.sf.net>
+
+       * tests/examples/seek/seek.c:
+         Don't crash when having no visualisations.
+
 2008-08-16  David Schleef  <ds@schleef.org>
 
        * gst/typefind/gsttypefindfunctions.c: DV typefinding.  Remove
index 07e3192..70754db 100644 (file)
@@ -1846,14 +1846,17 @@ vis_combo_cb (GtkComboBox * combo, GstPipeline * pipeline)
 
   /* get the selected index and get the factory for this index */
   index = gtk_combo_box_get_active (GTK_COMBO_BOX (vis_combo));
-  entry = &g_array_index (vis_entries, VisEntry, index);
-  /* create an instance of the element from the factory */
-  element = gst_element_factory_create (entry->factory, NULL);
-  if (!element)
-    return;
-
-  /* set vis plugin for playbin2 */
-  g_object_set (pipeline, "vis-plugin", element, NULL);
+  if (vis_entries->len > 0) {
+    entry = &g_array_index (vis_entries, VisEntry, index);
+
+    /* create an instance of the element from the factory */
+    element = gst_element_factory_create (entry->factory, NULL);
+    if (!element)
+      return;
+
+    /* set vis plugin for playbin2 */
+    g_object_set (pipeline, "vis-plugin", element, NULL);
+  }
 }
 
 static void