From 170e28dce7aeaa1a6f14aee956dc98e442f35be0 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 6 Mar 2004 11:18:28 +0000 Subject: [PATCH] ext/ogg/gstoggdemux.c: make sure to handle the case where there's no current chain gracefully. Original commit message from CVS: * ext/ogg/gstoggdemux.c: (gst_ogg_get_pad_by_pad), (gst_ogg_demux_src_query): make sure to handle the case where there's no current chain gracefully. --- ChangeLog | 7 +++++++ ext/ogg/gstoggdemux.c | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/ChangeLog b/ChangeLog index 007d831..d145979 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-03-06 Benjamin Otte + + * ext/ogg/gstoggdemux.c: (gst_ogg_get_pad_by_pad), + (gst_ogg_demux_src_query): + make sure to handle the case where there's no current chain + gracefully. + 2004-03-05 David Schleef * ext/aalib/gstaasink.c: (gst_aasink_fixate), (gst_aasink_init): diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c index 4bf8815..576854b 100644 --- a/ext/ogg/gstoggdemux.c +++ b/ext/ogg/gstoggdemux.c @@ -272,6 +272,10 @@ gst_ogg_get_pad_by_pad (GstOggDemux *ogg, GstPad *pad) GSList *walk; GstOggPad *cur; + if (ogg->current_chain == -1) { + GST_DEBUG_OBJECT (ogg, "no active chain, returning NULL"); + return NULL; + } for (walk = CURRENT_CHAIN (ogg)->pads; walk; walk = g_slist_next (walk)) { cur = (GstOggPad *) walk->data; if (cur->pad == pad) @@ -288,6 +292,9 @@ gst_ogg_demux_src_query (GstPad *pad, GstQueryType type, GstOggDemux *ogg = GST_OGG_DEMUX (gst_pad_get_parent (pad)); GstOggPad *cur = gst_ogg_get_pad_by_pad (ogg, pad); + if (!cur) + return FALSE; + switch (type) { case GST_QUERY_TOTAL: { if (*format == GST_FORMAT_DEFAULT) { -- 2.7.4