From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 208.118.235.0/24 X-Spam-Status: No, score=-2.4 required=3.0 tests=AWL,BAYES_00 shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: dtas-all@80x24.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id DCD3A1FAC6 for ; Sun, 10 May 2015 07:47:18 +0000 (UTC) Received: from localhost ([::1]:32943 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrLxG-0001oU-7M for dtas-all@80x24.org; Sun, 10 May 2015 03:47:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44615) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrLxE-0001oP-DH for dtas-all@nongnu.org; Sun, 10 May 2015 03:47:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YrLx9-0006YC-At for dtas-all@nongnu.org; Sun, 10 May 2015 03:47:16 -0400 Received: from dcvr.yhbt.net ([64.71.152.64]:54944) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrLx9-0006Y2-5S for dtas-all@nongnu.org; Sun, 10 May 2015 03:47:11 -0400 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id D37C71FAC6; Sun, 10 May 2015 07:47:08 +0000 (UTC) From: Eric Wong To: Subject: [PATCH] tracklist: fix inf loop on ENOENT with repeat==1 Date: Sun, 10 May 2015 07:47:07 +0000 Message-Id: <1431244027-26767-1-git-send-email-e@80x24.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 64.71.152.64 Cc: Eric Wong X-BeenThere: dtas-all@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dtas-all-bounces+dtas-all=80x24.org@nongnu.org Sender: dtas-all-bounces+dtas-all=80x24.org@nongnu.org If a file is missing, we must not respect the repeat option set by the user to avoid infinite looping --- lib/dtas/tracklist.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/dtas/tracklist.rb b/lib/dtas/tracklist.rb index c008204..63fe4ec 100644 --- a/lib/dtas/tracklist.rb +++ b/lib/dtas/tracklist.rb @@ -69,12 +69,13 @@ class DTAS::Tracklist # :nodoc: def advance_track(repeat_ok = true) return if @list.empty? # @repeat == 1 for single track repeat - next_pos = @goto_pos || @pos + (@repeat == 1 ? 0 : 1) + repeat = repeat_ok ? @repeat : false + next_pos = @goto_pos || @pos + (repeat == 1 ? 0 : 1) next_off = @goto_off # nil by default @goto_pos = @goto_off = nil if @list[next_pos] @pos = next_pos - elsif @repeat && repeat_ok + elsif repeat next_pos = @pos = 0 else return -- EW