diff --git a/src/LCT.Common/FileOperations.cs b/src/LCT.Common/FileOperations.cs index 3641d7bf..a3ed559f 100644 --- a/src/LCT.Common/FileOperations.cs +++ b/src/LCT.Common/FileOperations.cs @@ -102,7 +102,7 @@ public Bom CombineComponentsFromExistingBOM(Bom components, string filePath) comparisonData.Components = comparisonData.Components?.GroupBy(x => new { x.Name, x.Version }).Select(y => y.First()).ToList(); - if (comparisonData.Dependencies.Count > 0) + if (comparisonData.Dependencies != null && comparisonData.Dependencies.Count > 0) { comparisonData.Dependencies.AddRange(components.Dependencies); } diff --git a/src/LCT.Common/FileParser.cs b/src/LCT.Common/FileParser.cs index e84876c5..005f23ab 100644 --- a/src/LCT.Common/FileParser.cs +++ b/src/LCT.Common/FileParser.cs @@ -23,7 +23,7 @@ public TomlTable ParseTomlFile(string filePath) table = TOML.Parse(reader); return table; } - catch(Exception ex) + catch(TomlParseException) { return new TomlTable(); } diff --git a/src/LCT.PackageIdentifier/ConanProcessor.cs b/src/LCT.PackageIdentifier/ConanProcessor.cs index 04065bfd..02f6b873 100644 --- a/src/LCT.PackageIdentifier/ConanProcessor.cs +++ b/src/LCT.PackageIdentifier/ConanProcessor.cs @@ -292,7 +292,7 @@ private static void GetDependecyDetails(List componentsForBOM, List lstComponentForBOM, ref int noOfDevDependent, List nodePackages) { var rootNode = nodePackages.FirstOrDefault(); - if (!rootNode.Dependencies.Any() || rootNode.Dependencies == null) + if (rootNode != null && (!rootNode.Dependencies.Any() || rootNode.Dependencies == null)) { throw new ArgumentNullException(nameof(nodePackages), "Dependency(requires) node name details not present in the root node."); } diff --git a/src/LCT.PackageIdentifier/NugetDevDependencyParser.cs b/src/LCT.PackageIdentifier/NugetDevDependencyParser.cs index dc43d67c..17caa57f 100644 --- a/src/LCT.PackageIdentifier/NugetDevDependencyParser.cs +++ b/src/LCT.PackageIdentifier/NugetDevDependencyParser.cs @@ -44,7 +44,9 @@ public static NugetDevDependencyParser Instance } } +#pragma warning disable CA1822 // Mark members as static public List Parse(string configFile) +#pragma warning restore CA1822 // Mark members as static { List containerList = new();