1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-24 16:58:51 -05:00

* defensive programming for old json data

This commit is contained in:
Reinhard Pointner 2013-10-18 11:42:04 +00:00
parent d421a0f55f
commit f7a99a2ede
2 changed files with 10 additions and 0 deletions

View File

@ -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<String> getEffectiveNames() {
if (aliasNames == null || aliasNames.length == 0) {
return Collections.singletonList(toString(name, year));
}
List<String> names = new ArrayList<String>(1 + aliasNames.length);
names.add(toString(name, year));
for (String alias : aliasNames) {

View File

@ -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<String> getEffectiveNames() {
if (aliasNames == null || aliasNames.length == 0) {
return Collections.singletonList(name);
}
return new AbstractList<String>() {
@Override