Fixed: Possible Null Ref in Old API

pull/4873/head
Qstick 4 years ago
parent 69f4f1c168
commit a6d509c871

@ -42,19 +42,12 @@ namespace NzbDrone.Api.Movies
protected MovieResource GetMovie(int id) protected MovieResource GetMovie(int id)
{ {
var movie = _movieService.GetMovie(id); var movie = _movieService.GetMovie(id);
var resource = MapToResource(movie, true); return MapToResource(movie);
return resource;
} }
protected MovieResource MapToResource(Core.Movies.Movie episode, bool includeSeries) protected MovieResource MapToResource(Movie movie)
{ {
var resource = episode.ToResource(); var resource = movie.ToResource();
if (includeSeries)
{
var series = episode ?? _movieService.GetMovie(episode.Id);
resource = series.ToResource();
}
return resource; return resource;
} }

@ -37,7 +37,7 @@ namespace NzbDrone.Api.Wanted
pagingSpec.FilterExpressions.Add(v => v.Monitored == true); pagingSpec.FilterExpressions.Add(v => v.Monitored == true);
} }
var resource = ApplyToPage(_movieCutoffService.MoviesWhereCutoffUnmet, pagingSpec, v => MapToResource(v, true)); var resource = ApplyToPage(_movieCutoffService.MoviesWhereCutoffUnmet, pagingSpec, v => MapToResource(v));
return resource; return resource;
} }

@ -32,7 +32,7 @@ namespace NzbDrone.Api.Wanted
pagingSpec.FilterExpressions.Add(v => v.Monitored == true); pagingSpec.FilterExpressions.Add(v => v.Monitored == true);
} }
var resource = ApplyToPage(_movieService.MoviesWithoutFiles, pagingSpec, v => MapToResource(v, true)); var resource = ApplyToPage(_movieService.MoviesWithoutFiles, pagingSpec, v => MapToResource(v));
return resource; return resource;
} }

Loading…
Cancel
Save