Check that switchKey isn't empty

This commit is contained in:
Andrew Schwartzmeyer committed 2016-07-01 14:36:15 -07:00
1 parent e3fd809d42
commit 75777b42ee
1 file changed
+1 -1
@@ -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);
}