[banshee] GStreamerSharp: prevent NRE from happening if there is no next track



commit bf842ed3474fd8eab956e7108f8b24a8f6160e64
Author: Andrés G. Aragoneses <knocte gmail com>
Date:   Wed Oct 30 17:01:20 2013 +0100

    GStreamerSharp: prevent NRE from happening if there is no next track
    
    If there is no next track (i.e.: you have only 1 video in your library
    and you play that video), a NullReferenceException would happen at the
    end of the playback of the current track.
    
    This null check is brought as a pristine copy of the one that exists
    on the unmanaged backend.

 .../Banshee.GStreamerSharp/PlayerEngine.cs         |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/PlayerEngine.cs 
b/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/PlayerEngine.cs
index 515d6f0..256bd5f 100644
--- a/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/PlayerEngine.cs
+++ b/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/PlayerEngine.cs
@@ -444,6 +444,13 @@ namespace Banshee.GStreamerSharp
                 // pick up the pieces.
                 return;
             }
+
+            // If there isn't a next track for us, release the block on the about-to-finish callback.
+            if (uri == null) {
+                next_track_set.Set ();
+                return;
+            }
+
             playbin.Uri = uri.AbsoluteUri;
 
             if (maybeVideo) {


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