Skip to content

Commit a9c7e79

Browse files
committed
Added null check
1 parent fef1b75 commit a9c7e79

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/PowerShellEditorServices/Services/TextDocument/Handlers/CompletionHandler.cs

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
using System;
5-
using System.Collections.Generic;
6-
using System.Linq;
7-
using System.Management.Automation;
8-
using System.Text;
9-
using System.Text.RegularExpressions;
10-
using System.Threading;
11-
using System.Threading.Tasks;
124
using Microsoft.Extensions.Logging;
135
using Microsoft.PowerShell.EditorServices.Services;
146
using Microsoft.PowerShell.EditorServices.Services.PowerShell;
@@ -20,6 +12,14 @@
2012
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
2113
using OmniSharp.Extensions.LanguageServer.Protocol.Document;
2214
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
15+
using System;
16+
using System.Collections.Generic;
17+
using System.Linq;
18+
using System.Management.Automation;
19+
using System.Text;
20+
using System.Text.RegularExpressions;
21+
using System.Threading;
22+
using System.Threading.Tasks;
2323

2424
namespace Microsoft.PowerShell.EditorServices.Handlers
2525
{
@@ -215,7 +215,7 @@ internal async Task<CompletionResults> GetCompletionsInFileAsync(
215215
_logger,
216216
cancellationToken).ConfigureAwait(false);
217217

218-
if (result.CompletionMatches.Count == 0)
218+
if (result is null || result.CompletionMatches.Count is 0)
219219
{
220220
return new CompletionResults(IsIncomplete: true, Array.Empty<CompletionItem>());
221221
}

0 commit comments

Comments
 (0)