aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2022-10-06 20:21:23 +0200
committerBond_009 <bond.009@outlook.com>2022-10-06 20:21:23 +0200
commita9a5fcde81060c9da2096235d61128006339a2ee (patch)
tree3c3f7da26dffcc1a6589bcfc1cec2a5634e92c0e /Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
parent927fe33d3a0ec7f9e0fb568cfd423c6e8b966c9d (diff)
Use ArgumentNullException.ThrowIfNull helper method
Did a simple search/replace on the whole repo (except the RSSDP project) This reduces LOC and should improve performance (methods containing a throw statement don't get inlined) ``` if \((\w+) == null\) \s+\{ \s+throw new ArgumentNullException\((.*)\); \s+\} ``` ``` ArgumentNullException.ThrowIfNull($1); ```
Diffstat (limited to 'Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs')
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs30
1 files changed, 6 insertions, 24 deletions
diff --git a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
index 2c4d6884d..b370e06ef 100644
--- a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
@@ -92,25 +92,13 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// </exception>
public ScheduledTaskWorker(IScheduledTask scheduledTask, IApplicationPaths applicationPaths, ITaskManager taskManager, ILogger logger)
{
- if (scheduledTask == null)
- {
- throw new ArgumentNullException(nameof(scheduledTask));
- }
+ ArgumentNullException.ThrowIfNull(scheduledTask);
- if (applicationPaths == null)
- {
- throw new ArgumentNullException(nameof(applicationPaths));
- }
+ ArgumentNullException.ThrowIfNull(applicationPaths);
- if (taskManager == null)
- {
- throw new ArgumentNullException(nameof(taskManager));
- }
+ ArgumentNullException.ThrowIfNull(taskManager);
- if (logger == null)
- {
- throw new ArgumentNullException(nameof(logger));
- }
+ ArgumentNullException.ThrowIfNull(logger);
ScheduledTask = scheduledTask;
_applicationPaths = applicationPaths;
@@ -249,10 +237,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
get => _triggers;
set
{
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value));
- }
+ ArgumentNullException.ThrowIfNull(value);
// Cleanup current triggers
if (_triggers != null)
@@ -281,10 +266,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
set
{
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value));
- }
+ ArgumentNullException.ThrowIfNull(value);
// This null check is not great, but is needed to handle bad user input, or user mucking with the config file incorrectly
var triggerList = value.Where(i => i != null).ToArray();