Skip to content

Commit 795e32c

Browse files
authored
Merge pull request github#14693 from michaelnebel/csharp/fixcompilerwarning
C#: Fix compiler warning of possible null de-reference.
2 parents b1c3915 + 0cf00eb commit 795e32c

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

csharp/extractor/Semmle.Extraction.CSharp/Entities/Attribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ private void ExtractArguments(TextWriter trapFile)
9191
// The current argument is not named
9292
// so the previous ones were also not named
9393
// so the child index matches the parameter index.
94-
isParamsParameter = Symbol?.AttributeConstructor?.Parameters[childIndex].IsParams == true;
94+
isParamsParameter = Symbol.AttributeConstructor?.Parameters[childIndex].IsParams == true;
9595
argSyntax = ctorArguments[childIndex];
9696
}
9797

csharp/extractor/Semmle.Extraction.CSharp/Entities/NonGeneratedSourceLocation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public override void Populate(TextWriter trapFile)
2222
Position.Span.Start.Line + 1, Position.Span.Start.Character + 1,
2323
Position.Span.End.Line + 1, Position.Span.End.Character);
2424

25-
var mapped = Symbol!.GetMappedLineSpan();
25+
var mapped = Symbol.GetMappedLineSpan();
2626
if (mapped.HasMappedPath && mapped.IsValid)
2727
{
2828
var mappedLoc = Create(Context, Location.Create(mapped.Path, default, mapped.Span));

csharp/extractor/Semmle.Extraction/Entities/Base/CachedEntity`1.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Diagnostics.CodeAnalysis;
12
using System.IO;
23
using Microsoft.CodeAnalysis;
34

@@ -30,6 +31,7 @@ protected CachedEntity(Context context) : base(context)
3031
/// <typeparam name="TSymbol">The type of the symbol.</typeparam>
3132
public abstract class CachedEntity<TSymbol> : CachedEntity where TSymbol : notnull
3233
{
34+
[NotNull]
3335
public TSymbol Symbol { get; }
3436

3537
protected CachedEntity(Context context, TSymbol symbol) : base(context)

0 commit comments

Comments
 (0)