Skip to content

Commit

Permalink
refactor: remove duplicate null checks (#821)
Browse files Browse the repository at this point in the history
# Motivation

- Simplify the codebase by removing duplicate checks that were already
performed earlier in the logic

# Description

- Removed two **if** statements checking for null values.
- These conditions were confirmed to be already validated in the
execution flow.
- No changes to the functionality.

# Testing

- Logic wasn't changed in tests in the CI passed.

# Impact

- No impact on functionality as the redundant checks were unnecessary.

# Additional Information

- None

# Checklist

- [x] My code adheres to the coding and style guidelines of the project.
- [x] I have performed a self-review of my code.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have made corresponding changes to the documentation.
- [x] I have thoroughly tested my modifications and added tests when
necessary.
- [x] Tests pass locally and in the CI.
- [x] I have assessed the performance impact of my modifications.
  • Loading branch information
aneojgurhem authored Jan 16, 2025
2 parents 91d9b12 + 89c6477 commit 0ad9ee2
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions Utils/src/ServerCertificateValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,6 @@ public static RemoteCertificateValidationCallback ValidationCallback(ILogger
return false;
}

if (certificate == null)
{
logger.LogDebug("Certificate is null!");
return false;
}

if (chain == null)
{
logger.LogDebug("Certificate chain is null!");
return false;
}

// If there is any error other than untrusted root or partial chain, fail the validation
if (chain.ChainStatus.Any(status => status.Status is not X509ChainStatusFlags.UntrustedRoot and not X509ChainStatusFlags.PartialChain))
{
Expand Down

0 comments on commit 0ad9ee2

Please sign in to comment.