Skip to content

Commit

Permalink
when there have no streams the progress will panic about index out of…
Browse files Browse the repository at this point in the history
… range [0] with length 0. (#1002)

fix it

Co-authored-by: bojue <dongying.bao@crgecent.com>
  • Loading branch information
tomhunts and bojue committed Jan 19, 2022
1 parent a4aac9c commit bfc1b1d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions downloader/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,10 @@ func (downloader *Downloader) aria2(title string, stream *types.Stream) error {

// Download download urls
func (downloader *Downloader) Download(data *types.Data) error {
if len(data.Streams) == 0 {
return fmt.Errorf("no streams in title %s", data.Title)
}

sortedStreams := genSortedStreams(data.Streams)
if downloader.option.InfoOnly {
printInfo(data, sortedStreams)
Expand Down

0 comments on commit bfc1b1d

Please sign in to comment.