1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

Fixed: Possible Null Ref in Old API

This commit is contained in:
Qstick 2020-08-16 00:33:49 -04:00
parent 69f4f1c168
commit a6d509c871
3 changed files with 5 additions and 12 deletions

View File

@ -42,19 +42,12 @@ protected MovieModuleWithSignalR(IMovieService movieService,
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;
} }

View File

@ -37,7 +37,7 @@ private PagingResource<MovieResource> GetCutoffUnmetMovies(PagingResource<MovieR
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;
} }

View File

@ -32,7 +32,7 @@ private PagingResource<MovieResource> GetMissingMovies(PagingResource<MovieResou
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;
} }