Skip to content

Commit 2e2a5d6

Browse files
authored
Merge pull request github#5420 from tamasvajk/feature/fix-nullable-warning
C#: Fix nullable warning
2 parents fbbec5d + 02cb383 commit 2e2a5d6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

csharp/extractor/Semmle.Extraction.CSharp/SymbolExtensions.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,14 @@ public static bool IsSourceDeclaration(this IParameterSymbol parameter)
625625
{
626626
try
627627
{
628-
return symbol.Accept(new Populators.Symbols(cx));
628+
var entity = symbol.Accept(new Populators.Symbols(cx));
629+
if (entity is null)
630+
{
631+
cx.ModelError(symbol, $"Symbol visitor returned null entity on symbol: {symbol}");
632+
}
633+
#nullable disable warnings
634+
return entity;
635+
#nullable restore warnings
629636
}
630637
catch (Exception ex) // lgtm[cs/catch-of-all-exceptions]
631638
{

0 commit comments

Comments
 (0)