Guard against potential null reference exception

This commit is contained in:
Jordan Brown
2020-07-10 11:26:32 -04:00
parent e542a2b5e8
commit 488d2d5f6e
3 changed files with 4 additions and 3 deletions
@@ -1,5 +1,6 @@
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System;
using Tgstation.Server.Api.Models.Internal;
using Tgstation.Server.Host.Components.Chat;
using Tgstation.Server.Host.Components.Deployment;
@@ -73,6 +74,6 @@ namespace Tgstation.Server.Host.Components.Watchdog
LoggerFactory.CreateLogger<PosixWatchdog>(),
settings,
instance,
settings.AutoStart.Value);
settings.AutoStart ?? throw new ArgumentNullException(nameof(settings)));
}
}
@@ -97,6 +97,6 @@ namespace Tgstation.Server.Host.Components.Watchdog
LoggerFactory.CreateLogger<BasicWatchdog>(),
settings,
instance,
settings.AutoStart.Value);
settings.AutoStart ?? throw new ArgumentNullException(nameof(settings)));
}
}
@@ -80,6 +80,6 @@ namespace Tgstation.Server.Host.Components.Watchdog
LoggerFactory.CreateLogger<WindowsWatchdog>(),
settings,
instance,
settings.AutoStart.Value);
settings.AutoStart ?? throw new ArgumentNullException(nameof(settings)));
}
}