mirror of
https://github.com/lidarr/Lidarr
synced 2025-02-25 15:22:42 +00:00
Simplify ManualImportModule null check
This commit is contained in:
parent
e8e4d76d73
commit
6713525757
2 changed files with 16 additions and 7 deletions
|
@ -47,14 +47,11 @@ private List<ManualImportResource> GetMediaFiles()
|
||||||
var downloadId = (string)Request.Query.downloadId;
|
var downloadId = (string)Request.Query.downloadId;
|
||||||
NzbDrone.Core.Music.Artist artist = null;
|
NzbDrone.Core.Music.Artist artist = null;
|
||||||
|
|
||||||
var artistIdQuery = Request.Query.artistId;
|
var artistIdQuery = Request.GetNullableIntegerQueryParameter("artistId", null);
|
||||||
if (artistIdQuery.HasValue)
|
|
||||||
|
if (artistIdQuery.HasValue && artistIdQuery.Value > 0)
|
||||||
{
|
{
|
||||||
var artistId = Convert.ToInt32(artistIdQuery.Value);
|
artist = _artistService.GetArtist(Convert.ToInt32(artistIdQuery.Value));
|
||||||
if (artistId > 0)
|
|
||||||
{
|
|
||||||
artist = _artistService.GetArtist(Convert.ToInt32(artistIdQuery.Value));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var filter = Request.GetBooleanQueryParameter("filterExistingFiles", true) ? FilterFilesType.Matched : FilterFilesType.None;
|
var filter = Request.GetBooleanQueryParameter("filterExistingFiles", true) ? FilterFilesType.Matched : FilterFilesType.None;
|
||||||
|
|
|
@ -78,5 +78,17 @@ public static Guid GetGuidQueryParameter(this Request request, string parameter,
|
||||||
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int? GetNullableIntegerQueryParameter(this Request request, string parameter, int? defaultValue = null)
|
||||||
|
{
|
||||||
|
var parameterValue = request.Query[parameter];
|
||||||
|
|
||||||
|
if (parameterValue.HasValue)
|
||||||
|
{
|
||||||
|
return int.Parse(parameterValue.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue