diff --git a/BinaryObjectScanner/Handler.cs b/BinaryObjectScanner/Handler.cs index c00549fb..1ccfc436 100644 --- a/BinaryObjectScanner/Handler.cs +++ b/BinaryObjectScanner/Handler.cs @@ -22,14 +22,15 @@ namespace BinaryObjectScanner var protections = new ProtectionDictionary(); // Preprocess the list of files - files = files?.Select(f => f.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar))?.ToList(); + files = files? + .Select(f => f.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar))? + .ToList(); // Iterate through all checks StaticChecks.PathCheckClasses.IterateWithAction(checkClass => { - var subProtections = checkClass?.PerformCheck(path, files); - if (subProtections != null) - protections.Append(path, subProtections); + var subProtections = checkClass.PerformCheck(path, files); + protections.Append(path, subProtections); }); return protections; @@ -58,12 +59,12 @@ namespace BinaryObjectScanner /// /// IPathCheck class representing the file type /// Path of the file or directory to check - /// Set of protections in path, null on error - private static List? PerformCheck(this IPathCheck impl, string? path, IEnumerable? files) + /// Set of protections in path, empty on error + private static List PerformCheck(this IPathCheck impl, string? path, IEnumerable? files) { // If we have an invalid path if (string.IsNullOrEmpty(path)) - return null; + return []; // Setup the list var protections = new List();