* fix potential NPE (for movies with missing release_data info)
This commit is contained in:
parent
3fa3128f65
commit
69854e02b4
|
@ -1490,7 +1490,9 @@ public class MediaDetection {
|
||||||
Movie movie = (Movie) model;
|
Movie movie = (Movie) model;
|
||||||
if (movie.getYear() > 0 && movie.getTmdbId() > 0) {
|
if (movie.getYear() > 0 && movie.getTmdbId() > 0) {
|
||||||
SimpleDate releaseDate = WebServices.TheMovieDB.getMovieInfo(movie, Locale.ENGLISH, false).getReleased();
|
SimpleDate releaseDate = WebServices.TheMovieDB.getMovieInfo(movie, Locale.ENGLISH, false).getReleased();
|
||||||
xattr.setCreationDate(releaseDate.getTimeStamp());
|
if (releaseDate != null) {
|
||||||
|
xattr.setCreationDate(releaseDate.getTimeStamp());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -158,7 +158,7 @@ public class TMDbClient implements MovieIdentificationService {
|
||||||
MovieInfo info = getMovieInfo(id, locale, false);
|
MovieInfo info = getMovieInfo(id, locale, false);
|
||||||
String name = info.getName();
|
String name = info.getName();
|
||||||
String[] aliasNames = info.getOriginalName() == null || info.getOriginalName().isEmpty() || info.getOriginalName().equals(name) ? new String[0] : new String[] { info.getOriginalName() };
|
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 tmdbid = info.getId();
|
||||||
int imdbid = info.getImdbId() != null ? info.getImdbId() : -1;
|
int imdbid = info.getImdbId() != null ? info.getImdbId() : -1;
|
||||||
return new Movie(name, aliasNames, year, imdbid, tmdbid, locale);
|
return new Movie(name, aliasNames, year, imdbid, tmdbid, locale);
|
||||||
|
|
Loading…
Reference in New Issue