From d5044386bf829125f948b6a706d9c590a60e9791 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 5 Jan 2016 09:21:05 +0000 Subject: tracklist: fix off-by-one error on track removal @pos is an array index, and should never go beyond the last element. --- lib/dtas/tracklist.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/dtas') 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 -- cgit v1.2.3-24-ge0c7