diff --git a/source/net/filebot/web/XEM.java b/source/net/filebot/web/XEM.java index b3bbbcc1..2435a6d7 100644 --- a/source/net/filebot/web/XEM.java +++ b/source/net/filebot/web/XEM.java @@ -48,12 +48,16 @@ public enum XEM { public String getSeriesName(Map> n, Integer s) { switch (this) { case AniDB: - return s == null ? null : n.get(Integer.toString(s)).get(0); + return s == null ? null : first(n.get(String.valueOf(s))); default: - return n.get("all").get(0); + return first(n.get("all")); } } + private String first(List values) { + return values == null || values.isEmpty() ? null : values.get(0); + } + protected final Resource> haveMap = Resource.lazy(this::getHaveMap); public Optional map(Episode episode, XEM destination) throws Exception {