Просмотр исходного кода

Calculate highest even when there are no episodes in a season

Zachary Kotlarek 9 лет назад
Родитель
Сommit
e1e7856fa5
1 измененных файлов с 4 добавлено и 1 удалено
  1. 4 1
      findTorrent.pl

+ 4 - 1
findTorrent.pl

@@ -481,7 +481,10 @@ sub readInputDir($) {
 	close(SEASON);
 
 	# Assume we need any missing episodes, and the next few (unless season_done is set)
-	my $highest = (sort { $b <=> $a } keys(%{ $series{'episodes'} }))[0];
+	my $highest = 0;
+	if (scalar(keys(%{ $series{'episodes'}))) {
+		$highest = (sort { $b <=> $a } keys(%{ $series{'episodes'} }))[0];
+	}
 	for (my $i = 1 ; $i <= $highest ; $i++) {
 		if (!$series{'episodes'}->{$i}) {
 			push(@{ $series{'need'} }, $i);