From f7a99a2ede10a7e6f59a34257c3069d35a271c26 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Fri, 18 Oct 2013 11:42:04 +0000 Subject: [PATCH] * defensive programming for old json data --- source/net/sourceforge/filebot/web/Movie.java | 5 +++++ source/net/sourceforge/filebot/web/SearchResult.java | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/source/net/sourceforge/filebot/web/Movie.java b/source/net/sourceforge/filebot/web/Movie.java index ff9b9901..f34c51f5 100644 --- a/source/net/sourceforge/filebot/web/Movie.java +++ b/source/net/sourceforge/filebot/web/Movie.java @@ -2,6 +2,7 @@ package net.sourceforge.filebot.web; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; public class Movie extends SearchResult { @@ -43,6 +44,10 @@ public class Movie extends SearchResult { @Override public List getEffectiveNames() { + if (aliasNames == null || aliasNames.length == 0) { + return Collections.singletonList(toString(name, year)); + } + List names = new ArrayList(1 + aliasNames.length); names.add(toString(name, year)); for (String alias : aliasNames) { diff --git a/source/net/sourceforge/filebot/web/SearchResult.java b/source/net/sourceforge/filebot/web/SearchResult.java index 0b9cc639..c9bd67ce 100644 --- a/source/net/sourceforge/filebot/web/SearchResult.java +++ b/source/net/sourceforge/filebot/web/SearchResult.java @@ -2,6 +2,7 @@ package net.sourceforge.filebot.web; import java.io.Serializable; import java.util.AbstractList; +import java.util.Collections; import java.util.List; public abstract class SearchResult implements Serializable { @@ -27,6 +28,10 @@ public abstract class SearchResult implements Serializable { } public List getEffectiveNames() { + if (aliasNames == null || aliasNames.length == 0) { + return Collections.singletonList(name); + } + return new AbstractList() { @Override