about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-01-05 09:21:05 +0000
committerEric Wong <e@80x24.org>2016-01-05 09:26:28 +0000
commitd5044386bf829125f948b6a706d9c590a60e9791 (patch)
tree8b867e28f5663fce25502dab62b836683511ae1f
parent5ed91df8ecc5775ffa1df67f40526a62155f7e7e (diff)
downloaddtas-d5044386bf829125f948b6a706d9c590a60e9791.tar.gz
@pos is an array index, and should never go beyond
the last element.
-rw-r--r--lib/dtas/tracklist.rb4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/dtas/tracklist.rb b/lib/dtas/tracklist.rb
index f610449..68e88f2 100644
--- a/lib/dtas/tracklist.rb
+++ b/lib/dtas/tracklist.rb
@@ -194,9 +194,7 @@ class DTAS::Tracklist # :nodoc:
     end
     track = @list.delete_at(idx)
     len = @list.size
-    if @pos >= len
-      @pos = len == 0 ? TL_DEFAULTS["pos"] : len
-    end
+    @pos = len - 1 if @pos >= len
     @goto_pos = @goto_pos = nil # TODO: reposition?
     track.to_path
   end