From ca5d4c1fcb02ce3c60f3ab679004e972d53df902 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Thu, 21 Aug 2008 11:20:36 +0000 Subject: [PATCH] tests/examples/seek/seek.c: Don't crash when having no visualisations. Original commit message from CVS: * tests/examples/seek/seek.c: Don't crash when having no visualisations. --- ChangeLog | 5 +++++ tests/examples/seek/seek.c | 17 ++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index cf8d48a784..e05f1bdef9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-08-21 Stefan Kost + + * tests/examples/seek/seek.c: + Don't crash when having no visualisations. + 2008-08-16 David Schleef * gst/typefind/gsttypefindfunctions.c: DV typefinding. Remove diff --git a/tests/examples/seek/seek.c b/tests/examples/seek/seek.c index 07e3192051..70754db557 100644 --- a/tests/examples/seek/seek.c +++ b/tests/examples/seek/seek.c @@ -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; + if (vis_entries->len > 0) { + entry = &g_array_index (vis_entries, VisEntry, index); - /* set vis plugin for playbin2 */ - g_object_set (pipeline, "vis-plugin", element, NULL); + /* 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