1
0
mirror of http://mpg123.de/trunk/.git synced 2025-08-07 21:02:55 +03:00

Be more helpful on empty playlist.

git-svn-id: svn://scm.orgis.org/mpg123/trunk@3188 35dc7657-300d-0410-a2e5-dc2837fedb53
This commit is contained in:
thor
2012-05-15 05:59:08 +00:00
parent 9c98b4a2e0
commit cec756fc9e

View File

@@ -53,6 +53,12 @@ else
write_list(); write_list();
} }
unless(@files)
{
print STDERR "There are no files to play.\n";
exit;
}
if($entry < 0 or $entry > $#files or $frame < 0) 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"; 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 sub write_list
{ {
unless(@files)
{
print STDERR "Refusing to write empty playlist.\n";
return;
}
open(LIST, '>', $listfile) or die "Cannot write Playlist"; open(LIST, '>', $listfile) or die "Cannot write Playlist";
print LIST "#M3U\n"; print LIST "#M3U\n";
print LIST "#current entry: $entry\n"; print LIST "#current entry: $entry\n";