Fix NPE
This commit is contained in:
parent
b960432c52
commit
a029bdf94c
|
@ -48,12 +48,16 @@ public enum XEM {
|
||||||
public String getSeriesName(Map<String, List<String>> n, Integer s) {
|
public String getSeriesName(Map<String, List<String>> n, Integer s) {
|
||||||
switch (this) {
|
switch (this) {
|
||||||
case AniDB:
|
case AniDB:
|
||||||
return s == null ? null : n.get(Integer.toString(s)).get(0);
|
return s == null ? null : first(n.get(String.valueOf(s)));
|
||||||
default:
|
default:
|
||||||
return n.get("all").get(0);
|
return first(n.get("all"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String first(List<String> values) {
|
||||||
|
return values == null || values.isEmpty() ? null : values.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
protected final Resource<Set<Integer>> haveMap = Resource.lazy(this::getHaveMap);
|
protected final Resource<Set<Integer>> haveMap = Resource.lazy(this::getHaveMap);
|
||||||
|
|
||||||
public Optional<Episode> map(Episode episode, XEM destination) throws Exception {
|
public Optional<Episode> map(Episode episode, XEM destination) throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue