From 46a181b9b186af79df7c19a4a0d9ddd3e13dfc71 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sun, 4 Sep 2016 00:40:23 +0800 Subject: [PATCH] getMirror must not return null --- source/net/filebot/web/TheTVDBClientV1.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/net/filebot/web/TheTVDBClientV1.java b/source/net/filebot/web/TheTVDBClientV1.java index a0785ace..8059dc0f 100644 --- a/source/net/filebot/web/TheTVDBClientV1.java +++ b/source/net/filebot/web/TheTVDBClientV1.java @@ -35,7 +35,9 @@ import net.filebot.ResourceManager; public class TheTVDBClientV1 extends AbstractEpisodeListProvider implements ArtworkProvider { - private final Map mirrors = MirrorType.newMap(); + private static final String DEFAULT_MIRROR = "http://thetvdb.com"; + + private static final Map mirrors = MirrorType.newMap(); private final String apikey; @@ -233,7 +235,7 @@ public class TheTVDBClientV1 extends AbstractEpisodeListProvider implements Artw protected String getMirror(MirrorType mirrorType) throws Exception { // use default server if (mirrorType == MirrorType.NULL) { - return "http://thetvdb.com"; + return DEFAULT_MIRROR; } synchronized (mirrors) { @@ -259,7 +261,7 @@ public class TheTVDBClientV1 extends AbstractEpisodeListProvider implements Artw } // return selected mirror - return mirrors.get(mirrorType); + return mirrors.getOrDefault(mirrorType, DEFAULT_MIRROR); } }