C#: Fix compiler warnings.

This commit is contained in:
Michael Nebel
2023-12-08 11:45:36 +01:00
parent d3d594adaf
commit c8542e972e
3 changed files with 7 additions and 4 deletions

View File

@@ -20,7 +20,10 @@ namespace Semmle.Extraction.CSharp.Entities
protected override void Populate(TextWriter trapFile)
{
var info = Context.GetModel(node).GetSymbolInfo(node.Name);
// This is guaranteed to be non-null as we only deal with "using namespace" not "using X = Y"
var name = node.Name!;
var info = Context.GetModel(node).GetSymbolInfo(name);
if (node.StaticKeyword.IsKind(SyntaxKind.None))
{
@@ -33,7 +36,7 @@ namespace Semmle.Extraction.CSharp.Entities
}
else
{
Context.Extractor.MissingNamespace(node.Name.ToFullString(), Context.FromSource);
Context.Extractor.MissingNamespace(name.ToFullString(), Context.FromSource);
Context.ModelError(node, "Namespace not found");
return;
}