Skip to content

Commit 872a5c6

Browse files
committed
Add null check
1 parent 2acd3aa commit 872a5c6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/PowerShellEditorServices/Symbols/PesterDocumentSymbolProvider.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ IEnumerable<SymbolReference> IDocumentSymbolProvider.ProvideDocumentSymbols(
4343
/// <returns>true if the Ast represents a PowerShell command with arguments, false otherwise</returns>
4444
private static bool IsNamedCommandWithArguments(Ast ast)
4545
{
46+
CommandAst commandAst = ast as CommandAst;
4647

4748
return
48-
ast is CommandAst commandAst &&
49+
commandAst != null &&
4950
commandAst.InvocationOperator != TokenKind.Dot &&
5051
PesterSymbolReference.GetCommandType(commandAst.GetCommandName()).HasValue &&
5152
commandAst.CommandElements.Count >= 2;

0 commit comments

Comments
 (0)