From 63a1d415977dafdc45150d21d0dd65a47da59c7b Mon Sep 17 00:00:00 2001 From: TidusJar Date: Wed, 1 Aug 2018 08:48:57 +0100 Subject: [PATCH] Stop the root folder and profile calls from erroring --- .../Controllers/External/SonarrController.cs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/Ombi/Controllers/External/SonarrController.cs b/src/Ombi/Controllers/External/SonarrController.cs index 1929c2798..8715fa796 100644 --- a/src/Ombi/Controllers/External/SonarrController.cs +++ b/src/Ombi/Controllers/External/SonarrController.cs @@ -11,9 +11,9 @@ using Ombi.Settings.Settings.Models.External; namespace Ombi.Controllers.External { - [Admin] - [ApiV1] - [Produces("application/json")] + [Admin] + [ApiV1] + [Produces("application/json")] public class SonarrController : Controller { public SonarrController(ISonarrApi sonarr, ISettingsService settings) @@ -55,7 +55,11 @@ namespace Ombi.Controllers.External public async Task> GetProfiles() { var settings = await SonarrSettings.GetSettingsAsync(); - return await SonarrApi.GetProfiles(settings.ApiKey, settings.FullUri); + if (settings.Enabled) + { + return await SonarrApi.GetProfiles(settings.ApiKey, settings.FullUri); + } + return null; } /// @@ -66,7 +70,12 @@ namespace Ombi.Controllers.External public async Task> GetRootFolders() { var settings = await SonarrSettings.GetSettingsAsync(); - return await SonarrApi.GetRootFolders(settings.ApiKey, settings.FullUri); + if (settings.Enabled) + { + return await SonarrApi.GetRootFolders(settings.ApiKey, settings.FullUri); + } + + return null; } } } \ No newline at end of file