renderer-gst: Fix two criticals on startup
authorJens Georg <mail@jensge.org>
Sat, 15 Mar 2014 09:06:56 +0000 (10:06 +0100)
committerJens Georg <mail@jensge.org>
Sat, 15 Mar 2014 09:07:08 +0000 (10:07 +0100)
Signed-off-by: Jens Georg <mail@jensge.org>
src/librygel-renderer-gst/rygel-playbin-player.vala

index 9e8408b..0bfb912 100644 (file)
@@ -293,7 +293,8 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
         get {
             int64 dur=0;
 
-            if (this.playbin.source.query_duration (Format.TIME, out dur)) {
+            if (this.playbin.source != null &&
+                this.playbin.source.query_duration (Format.TIME, out dur)) {
                 return dur / Gst.USECOND;
             } else {
                 return 0;
@@ -303,9 +304,10 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
 
     public int64 size {
         get {
-            int64 dur;
+            int64 dur = 0;
 
-            if (this.playbin.source.query_duration (Format.BYTES, out dur)) {
+            if (this.playbin.source != null &&
+                this.playbin.source.query_duration (Format.BYTES, out dur)) {
                 return dur;
             } else {
                 return 0;