1
0
mirror of https://github.com/oliverbooth/VpSharp synced 2024-11-10 02:55:41 +00:00

Validate not-null ctor args

This commit is contained in:
Oliver Booth 2022-11-30 20:57:39 +00:00
parent 5b6bbac689
commit c7709d9b93
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
2 changed files with 6 additions and 1 deletions

View File

@ -30,7 +30,10 @@ public sealed class CommandsExtension : VirtualParadiseClientExtension
public CommandsExtension(VirtualParadiseClient client, CommandsExtensionConfiguration configuration)
: base(client)
{
_configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
ArgumentNullException.ThrowIfNull(client);
ArgumentNullException.ThrowIfNull(configuration);
_configuration = configuration;
_configuration.Services ??= client.Services;
}

View File

@ -44,8 +44,10 @@ public sealed partial class VirtualParadiseClient : IDisposable
/// Initializes a new instance of the <see cref="VirtualParadiseClient" /> class with a specified configuration.
/// </summary>
/// <value>The configuration for this client.</value>
/// <exception cref="ArgumentNullException"><paramref name="configuration" /> is <see langword="null" />.</exception>
public VirtualParadiseClient(VirtualParadiseConfiguration configuration)
{
ArgumentNullException.ThrowIfNull(configuration);
Services = configuration.Services;
_configuration = new VirtualParadiseConfiguration(configuration);
Initialize();