diff --git a/src/NzbDrone.Core/Messaging/Commands/CommandExecutor.cs b/src/NzbDrone.Core/Messaging/Commands/CommandExecutor.cs index f430aa4df..ee1946b1e 100644 --- a/src/NzbDrone.Core/Messaging/Commands/CommandExecutor.cs +++ b/src/NzbDrone.Core/Messaging/Commands/CommandExecutor.cs @@ -67,13 +67,15 @@ namespace NzbDrone.Core.Messaging.Commands private void ExecuteCommand(TCommand command, CommandModel commandModel) where TCommand : Command { - var handlerContract = typeof(IExecute<>).MakeGenericType(command.GetType()); - var handler = (IExecute)_serviceFactory.Build(handlerContract); - - _logger.Trace("{0} -> {1}", command.GetType().Name, handler.GetType().Name); + IExecute handler = null; try { + var handlerContract = typeof(IExecute<>).MakeGenericType(command.GetType()); + handler = (IExecute)_serviceFactory.Build(handlerContract); + + _logger.Trace("{0} -> {1}", command.GetType().Name, handler.GetType().Name); + _commandQueueManager.Start(commandModel); BroadcastCommandUpdate(commandModel); @@ -108,9 +110,12 @@ namespace NzbDrone.Core.Messaging.Commands { ProgressMessageContext.CommandModel = null; } - } - _logger.Trace("{0} <- {1} [{2}]", command.GetType().Name, handler.GetType().Name, commandModel.Duration.ToString()); + if (handler != null) + { + _logger.Trace("{0} <- {1} [{2}]", command.GetType().Name, handler.GetType().Name, commandModel.Duration.ToString()); + } + } } private void BroadcastCommandUpdate(CommandModel command)