Skip to content
This repository has been archived by the owner on Dec 8, 2024. It is now read-only.

Commit

Permalink
Merge pull request #18 from Mistobaan/master
Browse files Browse the repository at this point in the history
Add check for parameter existence in parsing of #EXTINF tag.
  • Loading branch information
grafov committed Apr 5, 2015
2 parents 09b6833 + b3786aa commit dc971df
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,10 +511,16 @@ func decodeLineOfMediaPlaylist(p *MediaPlaylist, wv *WV, state *decodingState, l
state.tagInf = true
state.listType = MEDIA
params := strings.SplitN(line[8:], ",", 2)
if state.duration, err = strconv.ParseFloat(params[0], 64); strict && err != nil {
return fmt.Errorf("Duration parsing error: %s", err)
if len(params) > 0 {
if state.duration, err = strconv.ParseFloat(params[0], 64); strict && err != nil {
return fmt.Errorf("Duration parsing error: %s", err)
}
}
if len(params) > 1 {
title = params[1]
} else {
title = "<no title>"
}
title = params[1]
case !state.tagDiscontinuity && strings.HasPrefix(line, "#EXT-X-DISCONTINUITY"):
state.tagDiscontinuity = true
state.listType = MEDIA
Expand Down

0 comments on commit dc971df

Please sign in to comment.