[gnome-games] Handle gst_element_factory_make() returning NULL (Bug #576745)



commit 2a7d5af24ab0619061e7cd89c3d07ab2761e4ecb
Author: Robert Ancell <robert ancell gmail com>
Date:   Mon Apr 27 10:54:41 2009 +1000

    Handle gst_element_factory_make() returning NULL (Bug #576745)
---
 libgames-support/games-sound.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libgames-support/games-sound.c b/libgames-support/games-sound.c
index 587f7be..0bd89bc 100644
--- a/libgames-support/games-sound.c
+++ b/libgames-support/games-sound.c
@@ -135,6 +135,8 @@ games_sound_init (void)
   g_assert (g_thread_supported ());
 
   pipeline = gst_element_factory_make ("playbin", "playbin");
+  if (pipeline == NULL)
+    return;
 
   threads = g_thread_pool_new ((GFunc) games_sound_thread_run,
 			       NULL, 10, FALSE, &err);
@@ -195,13 +197,14 @@ games_sound_play (const gchar * filename)
 {
 #if defined(HAVE_GSTREAMER)
   GError *err = NULL;
-
+    
   if (!sound_enabled)
     return;
   if (!sound_init)
     games_sound_init ();
 
-  g_thread_pool_push (threads, (gchar *) filename, &err);
+  if (sound_init)
+    g_thread_pool_push (threads, (gchar *) filename, &err);
 
 #elif defined(HAVE_SDL_MIXER)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]