diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-09-09 08:09:25 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-09-09 08:21:15 +0000 |
commit | 40411aa35b2889ba0ebc919a29d7c895e416ec5e (patch) | |
tree | 14259234328dc4d20a79098eb475530742a1e3a8 /lib/dtas | |
parent | ddb1f774839b7935968fe86a937dd305a9233d89 (diff) | |
download | dtas-40411aa35b2889ba0ebc919a29d7c895e416ec5e.tar.gz |
Non-repeating tracklists should stop playing when there's nothing to go back to.
Diffstat (limited to 'lib/dtas')
-rw-r--r-- | lib/dtas/tracklist.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/dtas/tracklist.rb b/lib/dtas/tracklist.rb index 094c22d..644c57f 100644 --- a/lib/dtas/tracklist.rb +++ b/lib/dtas/tracklist.rb @@ -120,6 +120,10 @@ class DTAS::Tracklist def previous! return if @list.empty? prev_idx = @pos - 1 - @goto_pos = @list[prev_idx] ? prev_idx : nil + if prev_idx < 0 + # stop playback if nothing to go back to. + prev_idx = @repeat ? @list.size - 1 : @list.size + end + @goto_pos = prev_idx end end |