Home / Vulnerability Database / Kotlin : Error handling: catching NullPointerException
Kotlin

Kotlin : Error handling: catching NullPointerException

Classification

Overview

Catch exceptions of NullPointerException type is usually considered to be a bad practice.

Catch NullPointerException usually occurs in one of three cases:

  1. There was a null pointer dereference. The developer decided that it is easier to catch an exception than to solve the problem that caused it.
  2. Application deliberately throws NullPointerException to report an error.
  3. NullPointerException catcher is part of the mechanism of testing, in which the application is given incorrect data as an input.

Catching NullPointerException is acceptable only in the latter case.

LOW

DerScanner Severity Score

Do you want to fix Kotlin : Error handling: catching NullPointerException in your application?

See also

Kotlin

Kotlin : Missing required cryptographic step

Kotlin

Kotlin : Logging into system output

Kotlin

Kotlin : Call of notify() in synchronized block