mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
Kotlin: Exclude operands of NotNullExpr from NullMaybe query
This commit is contained in:
@@ -21,6 +21,8 @@ from VarAccess access, SsaSourceVariable var, string msg, Expr reason
|
||||
where
|
||||
nullDeref(var, access, msg, reason) and
|
||||
// Exclude definite nulls here, as these are covered by `NullAlways.ql`.
|
||||
not alwaysNullDeref(var, access)
|
||||
not alwaysNullDeref(var, access) and
|
||||
// Exclude operands of `!!` in Kotlin, as `!!` means explicit opt out by the user.
|
||||
not access.getParent() instanceof NotNullExpr
|
||||
select access, "Variable $@ may be null here " + msg + ".", var.getVariable(),
|
||||
var.getVariable().getName(), reason, "this"
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
| Test.kt:6:13:6:13 | d | Variable $@ may be null here because of $@ assignment. | Test.kt:2:5:2:25 | Double d | d | Test.kt:2:5:2:25 | d | this |
|
||||
|
||||
Reference in New Issue
Block a user