* fix potential NPE (for movies with missing release_data info)

This commit is contained in:
Reinhard Pointner 2014-12-05 09:57:50 +00:00
parent 3fa3128f65
commit 69854e02b4
2 changed files with 4 additions and 2 deletions

View File

@ -1490,7 +1490,9 @@ public class MediaDetection {
Movie movie = (Movie) model;
if (movie.getYear() > 0 && movie.getTmdbId() > 0) {
SimpleDate releaseDate = WebServices.TheMovieDB.getMovieInfo(movie, Locale.ENGLISH, false).getReleased();
xattr.setCreationDate(releaseDate.getTimeStamp());
if (releaseDate != null) {
xattr.setCreationDate(releaseDate.getTimeStamp());
}
}
}
} catch (Exception e) {

View File

@ -158,7 +158,7 @@ public class TMDbClient implements MovieIdentificationService {
MovieInfo info = getMovieInfo(id, locale, false);
String name = info.getName();
String[] aliasNames = info.getOriginalName() == null || info.getOriginalName().isEmpty() || info.getOriginalName().equals(name) ? new String[0] : new String[] { info.getOriginalName() };
int year = info.getReleased().getYear();
int year = info.getReleased() != null ? info.getReleased().getYear() : id.getYear();
int tmdbid = info.getId();
int imdbid = info.getImdbId() != null ? info.getImdbId() : -1;
return new Movie(name, aliasNames, year, imdbid, tmdbid, locale);