mirror of
https://github.com/github/codeql.git
synced 2025-12-17 17:23:36 +01:00
24 lines
553 B
Plaintext
24 lines
553 B
Plaintext
/**
|
|
* @id cs/examples/null-argument
|
|
* @name Add null to collection
|
|
* @description Finds places where we add 'null' to a collection.
|
|
* @tags null
|
|
* parameter
|
|
* argument
|
|
* collection
|
|
* add
|
|
*/
|
|
|
|
import csharp
|
|
|
|
from MethodCall call, Method add
|
|
where
|
|
call.getTarget() = add.getAnUltimateImplementor*() and
|
|
add.hasName("Add") and
|
|
add
|
|
.getDeclaringType()
|
|
.getUnboundDeclaration()
|
|
.hasQualifiedName("System.Collections.Generic.ICollection<>") and
|
|
call.getAnArgument() instanceof NullLiteral
|
|
select call
|