[gnac/devel] Made libgnac more resilient to potential errors



commit f5ef25dc166bfd5b4b967a550ed1873dc1b4a719
Author: Benoît Dupasquier <bdupasqu src gnome org>
Date:   Fri Jun 18 20:35:19 2010 +0100

    Made libgnac more resilient to potential errors

 libgnac/libgnac-gst.c        |    2 ++
 libgnac/libgnac-media-item.c |    4 ++++
 2 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/libgnac/libgnac-gst.c b/libgnac/libgnac-gst.c
index 8811c71..4c695e8 100644
--- a/libgnac/libgnac-gst.c
+++ b/libgnac/libgnac-gst.c
@@ -64,6 +64,8 @@ libgnac_gst_stop(LibgnacMediaItem  *item,
 {
   g_return_if_fail(!error || !*error);
 
+  if (!item) return;
+
   if (item->pipeline) {
     libgnac_gst_clean_pipeline(item);
   }
diff --git a/libgnac/libgnac-media-item.c b/libgnac/libgnac-media-item.c
index c8827c6..81fabb4 100644
--- a/libgnac/libgnac-media-item.c
+++ b/libgnac/libgnac-media-item.c
@@ -179,6 +179,8 @@ libgnac_item_stop(LibgnacMediaItem  *item,
   GError *err = NULL;
   g_return_if_fail(error == NULL || *error == NULL);
 
+  if (!item) return;
+
   libgnac_item_clear_event_src(item);
   libgnac_gst_stop(item, &err);
   // TODO propagate error here
@@ -246,6 +248,8 @@ libgnac_item_init_event_src(LibgnacMediaItem *item)
 void
 libgnac_item_clear_event_src(LibgnacMediaItem *item)
 {
+  if (!item) return;
+
   if (item->timeout_id) {
     g_source_remove(item->timeout_id);
     item->timeout_id = 0;



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