Fix a null-ref exception in DynamicHelpImpl (#2292)

This commit is contained in:
Dongbo Wang
2021-03-11 09:14:44 -08:00
committed by GitHub
parent f8fb650774
commit dc38b451be
2 changed files with 17 additions and 0 deletions
+3
View File
@@ -151,6 +151,9 @@ namespace Microsoft.PowerShell
string commandName = null;
string parameterName = null;
// Simply return if nothing is rendered yet.
if (_singleton._tokens == null) { return; }
foreach(var token in _singleton._tokens)
{
var extent = token.Extent;
+14
View File
@@ -97,6 +97,13 @@ PARAMETERS
return paramHelp;
}
[SkippableFact]
public void DynHelp_GetFullHelp_OnEmptyLine()
{
TestSetup(KeyMode.Cmd);
Test("", Keys(_.F1, _.Enter));
}
[SkippableFact]
public void DynHelp_GetFullHelp()
{
@@ -108,6 +115,13 @@ PARAMETERS
));
}
[SkippableFact]
public void DynHelp_GetParameterHelp_OnEmptyLine()
{
TestSetup(KeyMode.Cmd);
Test("", Keys(_.Alt_h, _.Enter));
}
[SkippableFact]
public void DynHelp_GetParameterHelp_And_Clear()
{