TcM1911 / jamsonic

Subsonic console player for Linux, macOS and Windows
GNU General Public License v3.0
3 stars 1 forks source link

Skipping songs can cause a panic #22

Closed TcM1911 closed 6 years ago

TcM1911 commented 6 years ago

New player logic in master branch can hit a panic when skipping passed the end of the play queue.

Steps to reproduce:

  1. Start jamsonic with the -experimental flag.
  2. Start playing the second to last song in an album.
  3. Press "b" twice. Instead of just stopping the player tries to play an entry out of range which causes a panic.

Crash output:

panic: runtime error: makeslice: len out of range

goroutine 4 [running]:
github.com/TcM1911/jamsonic.(*playqueue).popSong(0xc42022e000, 0x0)
        /[REDACTED]/TcM1911/jamsonic/player.go:331 +0xa5
github.com/TcM1911/jamsonic.(*playqueue).(github.com/TcM1911/jamsonic.popSong)-fm(0xc4201c7c48)
        /[REDACTED]/TcM1911/jamsonic/player.go:182 +0x2a
github.com/TcM1911/jamsonic.(*Player).playNextInQueue(0xc4201c7c00, 0xc4207e1df0)
        /[REDACTED]/TcM1911/jamsonic/player.go:260 +0x4d
github.com/TcM1911/jamsonic.(*Player).playerLoop(0xc4201c7c00)
        /[REDACTED]/TcM1911/jamsonic/player.go:211 +0x78f
created by github.com/TcM1911/jamsonic.NewPlayer
        /[REDACTED]/TcM1911/jamsonic/player.go:63 +0x2f4