Skip to content

Commit 10095a5

Browse files
committed
Added null check
1 parent 840da46 commit 10095a5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/ExtractToNewComponentCodeActionProvider.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ private static bool IsInsideProperHtmlContent(RazorCodeActionContext context, Ma
128128
}
129129

130130
var endOwner = syntaxTree.Root.FindInnermostNode(endLocation.Value.AbsoluteIndex, true);
131+
132+
if (endOwner is null)
133+
{
134+
return null;
135+
}
131136

132137
// Correct selection to include the current node if the selection ends immediately after a closing tag.
133138
if (string.IsNullOrWhiteSpace(endOwner.ToFullString()) && endOwner.TryGetPreviousSibling(out var previousSibling))

0 commit comments

Comments
 (0)