Skip to content

Commit

Permalink
fix: code scanning alert (#926)
Browse files Browse the repository at this point in the history
* fix: code scanning alert

Signed-off-by: MTsfoni <[email protected]>

* fix: build warning from previous merge

Signed-off-by: MTsfoni <[email protected]>

---------

Signed-off-by: MTsfoni <[email protected]>
  • Loading branch information
mtsfoni authored Feb 2, 2025
1 parent ea4df9d commit 7089ec9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions CycloneDX/Services/DotnetCommandService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,14 @@ private static string GetDotnetPathOrDefault()
}
// DOTNET_ROOT specifies the location of the .NET runtimes, if they are not installed in the default location.
var dotnetRoot = Environment.GetEnvironmentVariable("DOTNET_ROOT");
return !string.IsNullOrEmpty(dotnetRoot)
? Path.Combine(dotnetRoot, fileName)

if (string.IsNullOrEmpty(dotnetRoot))
{
return fileName;
}
var fileInfo = new FileInfo(Path.Combine(dotnetRoot, fileName));
return fileInfo.Exists
? fileInfo.FullName
: fileName;
}

Expand Down
2 changes: 1 addition & 1 deletion CycloneDX/Services/NugetV3Service.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private string NormalizeUri(string input)

input = input.Trim();

if (Uri.TryCreate(input, ops, out Uri? result))
if (Uri.TryCreate(input, ops, out var result))
{
return result.ToString();
}
Expand Down

0 comments on commit 7089ec9

Please sign in to comment.