Skip to content

Commit

Permalink
WI #2608 Protect against null references in GetCompletionPerformParag…
Browse files Browse the repository at this point in the history
…raphAndSection
  • Loading branch information
fm-117 committed Jan 15, 2024
1 parent c720cf8 commit b6531e6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions TypeCobol.LanguageServer/Completion Factory/CompletionFactory.cs
Expand Up @@ -44,8 +44,16 @@ public static List<CompletionItem> GetCompletionPerformParagraphAndSection(FileC
}
}

completionItems.AddRange(paragraphs.Select(para => new CompletionItem(para.Name) { kind = CompletionItemKind.Reference }));
completionItems.AddRange(sections.Select(s => new CompletionItem(s.Name) { kind = CompletionItemKind.Reference }));
if (paragraphs != null)
{
completionItems.AddRange(paragraphs.Select(para => new CompletionItem(para.Name) { kind = CompletionItemKind.Reference }));
}

if (sections != null)
{
completionItems.AddRange(sections.Select(s => new CompletionItem(s.Name) { kind = CompletionItemKind.Reference }));
}

if (variables != null)
{
foreach (var variable in variables)
Expand Down

0 comments on commit b6531e6

Please sign in to comment.