Fix NPE caused by last page not being set in json response
This commit is contained in:
parent
038d9b1d99
commit
57333f5c99
|
@ -166,9 +166,13 @@ public class TheTVDBClient extends AbstractEpisodeListProvider implements Artwor
|
|||
List<Episode> episodes = new ArrayList<Episode>();
|
||||
List<Episode> specials = new ArrayList<Episode>();
|
||||
|
||||
for (int page = 1, lastPage = 1; page <= lastPage; page++) {
|
||||
Object json = requestJson("series/" + series.getId() + "/episodes?page=" + page, locale, Cache.ONE_DAY);
|
||||
lastPage = getInteger(getMap(json, "links"), "last");
|
||||
for (int i = 1, n = 1; i <= n; i++) {
|
||||
Object json = requestJson("series/" + series.getId() + "/episodes?page=" + i, locale, Cache.ONE_DAY);
|
||||
|
||||
Integer lastPage = getInteger(getMap(json, "links"), "last");
|
||||
if (lastPage != null) {
|
||||
n = lastPage;
|
||||
}
|
||||
|
||||
streamJsonObjects(json, "data").forEach(it -> {
|
||||
String episodeName = getString(it, "episodeName");
|
||||
|
|
Loading…
Reference in New Issue