Skip to content

Commit 607bed1

Browse files
authored
rawArgument in GetArgumentList cant be null (#5056)
since it is always guarded in the preceding code
1 parent 02e1cf0 commit 607bed1

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/vstest.console/Processors/Utilities/ArgumentProcessorUtilities.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,19 @@ internal class ArgumentProcessorUtilities
1818
/// <param name="argumentSeparator">Argument separator.</param>
1919
/// <param name="exceptionMessage">Exception Message.</param>
2020
/// <returns>Argument list.</returns>
21-
public static string[] GetArgumentList(string? rawArgument, char[] argumentSeparator, string exceptionMessage)
21+
public static string[] GetArgumentList(string rawArgument, char[] argumentSeparator, string exceptionMessage)
2222
{
23-
var argumentList = rawArgument?.Split(argumentSeparator, StringSplitOptions.RemoveEmptyEntries);
23+
var argumentList = rawArgument.Split(argumentSeparator, StringSplitOptions.RemoveEmptyEntries);
2424

2525
// Throw error in case of invalid argument.
26-
return argumentList == null || argumentList.Length <= 0 ? throw new CommandLineException(exceptionMessage) : argumentList;
26+
if (argumentList.Length <= 0)
27+
{
28+
throw new CommandLineException(exceptionMessage);
29+
}
30+
else
31+
{
32+
return argumentList;
33+
}
2734
}
2835

2936
/// <summary>

0 commit comments

Comments
 (0)