From cec756fc9e2bee2e020cf87cf51bac19ca071368 Mon Sep 17 00:00:00 2001 From: thor Date: Tue, 15 May 2012 05:59:08 +0000 Subject: [PATCH] Be more helpful on empty playlist. git-svn-id: svn://scm.orgis.org/mpg123/trunk@3188 35dc7657-300d-0410-a2e5-dc2837fedb53 --- scripts/conplay | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/conplay b/scripts/conplay index 9d83aef0..a198d653 100755 --- a/scripts/conplay +++ b/scripts/conplay @@ -53,6 +53,12 @@ else write_list(); } +unless(@files) +{ + print STDERR "There are no files to play.\n"; + exit; +} + if($entry < 0 or $entry > $#files or $frame < 0) { die "You got bad data in your playlist file (mismatch between current entry and total count, bad frame index). Clean that up.\n"; @@ -78,6 +84,11 @@ write_list(); sub write_list { + unless(@files) + { + print STDERR "Refusing to write empty playlist.\n"; + return; + } open(LIST, '>', $listfile) or die "Cannot write Playlist"; print LIST "#M3U\n"; print LIST "#current entry: $entry\n";