Fix https://github.com/matthieugrieger/mumbledj/issues/11: Crash on skip when no song is playing
This commit is contained in:
parent
73d5050f9d
commit
9667157d63
|
@ -1,6 +1,9 @@
|
|||
MumbleDJ Changelog
|
||||
==================
|
||||
|
||||
### January 7, 2015 -- `v2.2.3`
|
||||
* Fixed a crash caused by entering a skip request when no song is currently playing.
|
||||
|
||||
### January 5, 2015 -- `v2.2.1, v2.2.2`
|
||||
* Attached `gumbleutil.AutoBitrate` EventListener to client. This should hopefully fix the issues with audio cutting in and out.
|
||||
* Moved dependency installation to default `make` command to better enforce new updates.
|
||||
|
|
|
@ -179,6 +179,7 @@ func add(user *gumble.User, username, url string) {
|
|||
// Performs skip functionality. Adds a skip to the skippers slice for the current song, and then
|
||||
// evaluates if a skip should be performed. Both skip and forceskip are implemented here.
|
||||
func skip(user *gumble.User, username string, admin, playlistSkip bool) {
|
||||
if dj.audioStream.IsPlaying() {
|
||||
if playlistSkip {
|
||||
if dj.queue.CurrentItem().ItemType() == "playlist" {
|
||||
if err := dj.queue.CurrentItem().AddSkip(username); err == nil {
|
||||
|
@ -223,6 +224,9 @@ func skip(user *gumble.User, username string, admin, playlistSkip bool) {
|
|||
panic(errors.New("An error occurred while adding a skip to the current song."))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
user.Send(NO_MUSIC_PLAYING_MSG)
|
||||
}
|
||||
}
|
||||
|
||||
// Performs volume functionality. Checks input value against LowestVolume and HighestVolume from
|
||||
|
|
Reference in a new issue