From 75777b42ee2e0df56f833f3f80d4a96836dd84ab Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Fri, 1 Jul 2016 11:18:34 -0700 Subject: [PATCH] Check that switchKey isn't empty --- .../host/msh/CommandLineParameterParser.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs index f595080f6..e2695a7c8 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs @@ -354,7 +354,7 @@ namespace Microsoft.PowerShell switchKey = switchKey.Substring(1); // chop off the second dash so we're agnostic wrt specifying - or -- - if (SpecialCharacters.IsDash(switchKey[0])) + if (!String.IsNullOrEmpty(switchKey) && SpecialCharacters.IsDash(switchKey[0])) { switchKey = switchKey.Substring(1); }