Fixed panic when attempting to play empty queue

This commit is contained in:
Jake 2015-02-17 23:39:37 +00:00 committed by Jake
parent 38be691913
commit 2b9394a371

View file

@ -210,7 +210,7 @@ func add(user *gumble.User, username, url string) {
oldLength := dj.queue.Len()
if newPlaylist, err := NewPlaylist(username, shortUrl); err == nil {
dj.client.Self.Channel.Send(fmt.Sprintf(PLAYLIST_ADDED_HTML, username, newPlaylist.title), false)
if oldLength == 0 && !dj.audioStream.IsPlaying() {
if oldLength == 0 && dj.queue.Len() != 0 && !dj.audioStream.IsPlaying() {
if err := dj.queue.CurrentSong().Download(); err == nil {
dj.queue.CurrentSong().Play()
} else {