dashdemux: protect from access to empty list data

Check if the list has elements before trying to access the last one
and causing a segfault
This commit is contained in:
Thiago Santos 2013-07-02 21:28:26 -03:00
parent cd26bd51a1
commit 94c6497dfa

View file

@ -2940,7 +2940,7 @@ gst_mpd_client_setup_representation (GstMpdClient * client,
}
/* check duration of last segment */
last_media_segment = g_list_last (stream->segments)->data;
last_media_segment = stream->segments ? g_list_last (stream->segments)->data : NULL;
if (last_media_segment && GST_CLOCK_TIME_IS_VALID (PeriodEnd)) {
if (last_media_segment->start_time + last_media_segment->duration >
PeriodEnd) {