Skip to content

Commit 291abbd

Browse files
committed
PackageIdentityArgument: Add null return when empty tokens
1 parent b2d6491 commit 291abbd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Cli/dotnet/CommonArguments.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ public static CliArgument<PackageIdentity> PackageIdentityArgument(bool requireA
2424

2525
private static PackageIdentity ParsePackageIdentity(ArgumentResult argumentResult)
2626
{
27+
if (argumentResult.Tokens.Count == 0)
28+
{
29+
return null;
30+
}
2731
var token = argumentResult.Tokens[0].Value;
2832
var versionSeparatorIndex = token.IndexOf('@');
2933
if (versionSeparatorIndex == -1)

0 commit comments

Comments
 (0)