From 69854e02b447f1fccbacf18e5743feb27222ca78 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Fri, 5 Dec 2014 09:57:50 +0000 Subject: [PATCH] * fix potential NPE (for movies with missing release_data info) --- source/net/filebot/media/MediaDetection.java | 4 +++- source/net/filebot/web/TMDbClient.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source/net/filebot/media/MediaDetection.java b/source/net/filebot/media/MediaDetection.java index ec28c2b8..5885aa62 100644 --- a/source/net/filebot/media/MediaDetection.java +++ b/source/net/filebot/media/MediaDetection.java @@ -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) { diff --git a/source/net/filebot/web/TMDbClient.java b/source/net/filebot/web/TMDbClient.java index 313e16ff..96bd8d7a 100644 --- a/source/net/filebot/web/TMDbClient.java +++ b/source/net/filebot/web/TMDbClient.java @@ -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);