Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion java/ql/src/Likely Bugs/Nullness/NullMaybe.ql
Original file line number Diff line number Diff line change
Expand Up @@ -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
// Kotlin enforces this already:
not access.getLocation().getFile().isKotlinSourceFile()
select access, "Variable $@ may be null here " + msg + ".", var.getVariable(),
var.getVariable().getName(), reason, "this"
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Likely Bugs/Nullness/NullMaybe.ql
7 changes: 7 additions & 0 deletions java/ql/test/kotlin/query-tests/NullMaybe/Test.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fun fn(b: Boolean) {
var d: Double? = null
if (b) {
d = 1.0
}
println(d!!)
}