Skip to content

Commit

Permalink
Remove neasted if code scan 287
Browse files Browse the repository at this point in the history
  • Loading branch information
rube200 committed Oct 29, 2023
1 parent c8fc62b commit 8e717a5
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public virtual async Task<ICollection<Assembly>> LoadPluginAssembliesAsync()

public Task<NuGetInstallResult> InstallPackageAsync(string packageName, string? version = null, bool isPreRelease = false)
{
return InstallOrUpdateAsync(packageName, version, isPreRelease, false);
return InstallOrUpdateAsync(packageName, version, isPreRelease);
}

public Task<NuGetInstallResult> UpdatePackageAsync(string packageName, string? version = null, bool isPreRelease = false)
Expand Down Expand Up @@ -80,10 +80,9 @@ private async Task<NuGetInstallResult> InstallOrUpdateAsync(string packageName,
}

NuGetVersion? nuGetVersion = null;
if (version is not null)
if (version is not null && !NuGetVersion.TryParse(version, out nuGetVersion))
{
if (!NuGetVersion.TryParse(version, out nuGetVersion))
return new NuGetInstallResult(NuGetInstallCode.InvalidVersion);
return new NuGetInstallResult(NuGetInstallCode.InvalidVersion);
}

var package = await m_NuGetPackageManager.QueryPackageExactAsync(packageName, version, isPreRelease);
Expand Down

0 comments on commit 8e717a5

Please sign in to comment.