Skip to content

Commit

Permalink
Merge pull request #171 from MrDave1999/patch
Browse files Browse the repository at this point in the history
fix: Add null checks in the constructor of some classes. 
This PR prevents a NullReferenceException.
  • Loading branch information
MrDave1999 authored Jun 17, 2024
2 parents e39af5a + 7dc62f5 commit 507173c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Binder/EnvBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ public EnvBinder()
/// Initializes a new instance of the <see cref="EnvBinder" /> class with environment variables provider.
/// </summary>
/// <param name="provider">The environment variables provider.</param>
/// <exception cref="ArgumentNullException"><c>provider</c> is <c>null</c>.</exception>
public EnvBinder(IEnvironmentVariablesProvider provider)
{
ThrowHelper.ThrowIfNull(provider, nameof(provider));
_configuration.EnvVars = provider;
}

Expand Down
2 changes: 2 additions & 0 deletions src/Reader/EnvReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ public EnvReader()
/// Initializes a new instance of the <see cref="EnvReader" /> class with environment variables provider.
/// </summary>
/// <param name="provider">The environment variables provider.</param>
/// <exception cref="ArgumentNullException"><c>provider</c> is <c>null</c>.</exception>
public EnvReader(IEnvironmentVariablesProvider provider)
{
ThrowHelper.ThrowIfNull(provider, nameof(provider));
_envVars = provider;
}

Expand Down
2 changes: 2 additions & 0 deletions src/Validator/EnvValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ public EnvValidator()
/// Initializes a new instance of the <see cref="EnvValidator" /> class with environment variables provider.
/// </summary>
/// <param name="provider">The environment variables provider.</param>
/// <exception cref="ArgumentNullException"><c>provider</c> is <c>null</c>.</exception>
public EnvValidator(IEnvironmentVariablesProvider provider)
{
ThrowHelper.ThrowIfNull(provider, nameof(provider));
_configuration.EnvVars = provider;
}

Expand Down

0 comments on commit 507173c

Please sign in to comment.