Fix NPE in JavaNullabilityChecker when checking equals-calls

This NPE was introduced in ce41b5745a
Prior to the latter change there was a synthetic PSI element for each
equals-related call, thus callOperationNode was not null here.

== are intentionally treated as safe calls, but for nullability checker
it's not relevant, it only should report warnings on real safe-calls
This commit is contained in:
Denis Zharkov
2017-12-14 14:29:47 +03:00
parent d64e8e3b33
commit fa6285d32a
7 changed files with 96 additions and 1 deletions
@@ -109,8 +109,9 @@ class JavaNullabilityChecker : AdditionalTypeChecker {
}
if (safeAccess) {
val safeAccessElement = c.call.callOperationNode?.psi ?: return
doIfNotNull(receiverArgument.type, { dataFlowValue }, c) {
c.trace.report(Errors.UNNECESSARY_SAFE_CALL.on(c.call.callOperationNode!!.psi, receiverArgument.type))
c.trace.report(Errors.UNNECESSARY_SAFE_CALL.on(safeAccessElement, receiverArgument.type))
}
return