1
0
mirror of https://github.com/oliverbooth/VpSharp synced 2024-11-23 00:48:47 +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) public CommandsExtension(VirtualParadiseClient client, CommandsExtensionConfiguration configuration)
: base(client) : base(client)
{ {
_configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); ArgumentNullException.ThrowIfNull(client);
ArgumentNullException.ThrowIfNull(configuration);
_configuration = configuration;
_configuration.Services ??= client.Services; _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. /// Initializes a new instance of the <see cref="VirtualParadiseClient" /> class with a specified configuration.
/// </summary> /// </summary>
/// <value>The configuration for this client.</value> /// <value>The configuration for this client.</value>
/// <exception cref="ArgumentNullException"><paramref name="configuration" /> is <see langword="null" />.</exception>
public VirtualParadiseClient(VirtualParadiseConfiguration configuration) public VirtualParadiseClient(VirtualParadiseConfiguration configuration)
{ {
ArgumentNullException.ThrowIfNull(configuration);
Services = configuration.Services; Services = configuration.Services;
_configuration = new VirtualParadiseConfiguration(configuration); _configuration = new VirtualParadiseConfiguration(configuration);
Initialize(); Initialize();