dotnet-architecture / eShopOnContainers

Cross-platform .NET sample microservices and container based application that runs on Linux Windows and macOS. Powered by .NET 7, Docker Containers and Azure Kubernetes Services. Supports Visual Studio, VS for Mac and CLI based environments with Docker CLI, dotnet CLI, VS Code or any other code editor. Moved to https://github.com/dotnet/eShop.
https://dot.net/architecture
24.53k stars 10.36k forks source link

Refactor redundant null check and use null-conditional operator #2053

Closed sulsoltanoff closed 1 year ago

sulsoltanoff commented 1 year ago

This pull request refactors two sections of the code to improve readability and robustness.

The first change updates the null check in the assignment of the filterQs variable to remove redundancy. The brand.HasValue check was used twice, which is not necessary. The null check was removed from the variable assignment and placed only in the if statement where it is needed.

The second change updates the call to GetAuthorizationContextAsync to use the null-conditional operator ?.. This helps to avoid a potential NullReferenceException if the model object is null.

dnfadmin commented 1 year ago

CLA assistant check
All CLA requirements met.