Avoid NPE
This commit is contained in:
parent
361e15508c
commit
1c21c37285
|
@ -730,11 +730,8 @@ public class MediaDetection {
|
||||||
if (similarity >= 1) {
|
if (similarity >= 1) {
|
||||||
return true;
|
return true;
|
||||||
} else if (similarity >= 0.5 && e.getSeason() == null && e.getEpisode() != null && e.getSpecial() == null) {
|
} else if (similarity >= 0.5 && e.getSeason() == null && e.getEpisode() != null && e.getSpecial() == null) {
|
||||||
for (SxE it : parseEpisodeNumber(f, false)) {
|
List<SxE> numbers = parseEpisodeNumber(f, false);
|
||||||
if (it.season < 0 && it.episode == e.getEpisode()) {
|
return numbers != null && numbers.stream().anyMatch(it -> it.season < 0 && it.episode == e.getEpisode());
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
@ -170,7 +171,7 @@ public final class SubtitleUtilities {
|
||||||
|
|
||||||
if (searchBySeries) {
|
if (searchBySeries) {
|
||||||
// search for subtitles for the given files
|
// search for subtitles for the given files
|
||||||
List<SxE> numbers = files.stream().flatMap(f -> parseEpisodeNumber(f, true).stream()).distinct().collect(toList());
|
List<SxE> numbers = files.stream().map(f -> parseEpisodeNumber(f, true)).filter(Objects::nonNull).flatMap(Collection::stream).distinct().collect(toList());
|
||||||
|
|
||||||
if (numbers.size() == 1) {
|
if (numbers.size() == 1) {
|
||||||
episodeFilter = numbers.stream().map(sxe -> new int[] { sxe.season, sxe.episode }).toArray(int[][]::new); // season-and-episode filter
|
episodeFilter = numbers.stream().map(sxe -> new int[] { sxe.season, sxe.episode }).toArray(int[][]::new); // season-and-episode filter
|
||||||
|
|
Loading…
Reference in New Issue