提交 614f0315 编写于 作者: D David Barbet

Fix null reference warnings in merge.

上级 90e76fbb
......@@ -45,7 +45,13 @@ public sealed override async Task ComputeRefactoringsAsync(CodeRefactoringContex
var operations = parentBlock.Operations;
var index = operations.IndexOf(ifOperation);
var analyzer = CreateAnalyzer(document.GetLanguageService<ISyntaxFactsService>(), ifStatement.SyntaxTree.Options);
var syntaxFactsService = document.GetLanguageService<ISyntaxFactsService>();
if (syntaxFactsService == null)
{
return;
}
var analyzer = CreateAnalyzer(syntaxFactsService, ifStatement.SyntaxTree.Options);
var (sections, target) = analyzer.AnalyzeIfStatementSequence(operations.AsSpan().Slice(index));
if (sections.IsDefaultOrEmpty)
{
......
......@@ -44,6 +44,10 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context)
{
var generator = SyntaxGenerator.GetGenerator(document);
var declarationService = document.GetLanguageService<ISymbolDeclarationService>();
if (declarationService == null)
{
return;
}
var semanticModel = await document.RequireSemanticModelAsync(cancellationToken).ConfigureAwait(false);
if (!Analyzer.TryGetAnalyzer(semanticModel.Compilation, out var analyzer))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册