Back to Intellij Community

NullChecksToSafeCall

plugins/kotlin/code-insight/descriptions/resources-en/inspectionDescriptions/NullChecksToSafeCall.html

2025.3-rc-2255 B
Original Source

Reports chained null-checks that can be replaced with safe-calls.

Example:

fun test(my: My?) {
      if (my != null && my.foo() != null) {}
  }

After the quick-fix is applied:

fun test(my: My?) {
      if (my?.foo() != null) {}
  }