Skip to content

Commit

Permalink
rawArgument in GetArgumentList cant be null (#5056)
Browse files Browse the repository at this point in the history
since it is always guarded in the preceding code
  • Loading branch information
SimonCropp authored May 23, 2024
1 parent 02e1cf0 commit 607bed1
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,19 @@ internal class ArgumentProcessorUtilities
/// <param name="argumentSeparator">Argument separator.</param>
/// <param name="exceptionMessage">Exception Message.</param>
/// <returns>Argument list.</returns>
public static string[] GetArgumentList(string? rawArgument, char[] argumentSeparator, string exceptionMessage)
public static string[] GetArgumentList(string rawArgument, char[] argumentSeparator, string exceptionMessage)
{
var argumentList = rawArgument?.Split(argumentSeparator, StringSplitOptions.RemoveEmptyEntries);
var argumentList = rawArgument.Split(argumentSeparator, StringSplitOptions.RemoveEmptyEntries);

// Throw error in case of invalid argument.
return argumentList == null || argumentList.Length <= 0 ? throw new CommandLineException(exceptionMessage) : argumentList;
if (argumentList.Length <= 0)
{
throw new CommandLineException(exceptionMessage);
}
else
{
return argumentList;
}
}

/// <summary>
Expand Down

0 comments on commit 607bed1

Please sign in to comment.