tsdemux: Don't query duration if program isn't active
diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c
index 1e1c0ea..35c7f29 100644
--- a/gst/mpegtsdemux/tsdemux.c
+++ b/gst/mpegtsdemux/tsdemux.c
@@ -496,6 +496,11 @@
gboolean res = FALSE;
gint64 val;
+ if (!demux->program) {
+ GST_DEBUG_OBJECT (demux, "No active program yet, can't provide duration");
+ return FALSE;
+ }
+
/* Get total size in bytes */
if (gst_pad_peer_query_duration (base->sinkpad, GST_FORMAT_BYTES, &val)) {
/* Convert it to duration */