[grilo-plugins] youtube: check operation_data



commit 46a5db24e404cf87b48a6e2fecaaa51eb4dd2d5a
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Fri Oct 17 13:53:23 2014 +0000

    youtube: check operation_data
    
    Before converting the stored data in operation to a GCancellable object, verify
    it really contains a value.

 src/youtube/grl-youtube.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/youtube/grl-youtube.c b/src/youtube/grl-youtube.c
index eb97dfa..bb0dedc 100644
--- a/src/youtube/grl-youtube.c
+++ b/src/youtube/grl-youtube.c
@@ -1662,11 +1662,16 @@ static void
 grl_youtube_source_cancel (GrlSource *source,
                            guint operation_id)
 {
-  GCancellable *cancellable;
+  GCancellable *cancellable = NULL;
+  gpointer data;
 
   GRL_DEBUG (__FUNCTION__);
 
-  cancellable = G_CANCELLABLE (grl_operation_get_data (operation_id));
+  data = grl_operation_get_data (operation_id);
+
+  if (data) {
+    cancellable = G_CANCELLABLE (data);
+  }
 
   if (cancellable) {
     g_cancellable_cancel (cancellable);


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