Java

Java

Made by DeepSource

Value is guaranteed to be accessed while null after an exception is thrown JAVA-S0266

Bug risk
Critical

There is a statement or branch within a catch block which, if executed, guarantees that the variable accessed at this point will be null, unless a runtime exception is thrown (for any reason) before the access.

try {
  // ...
} catch (...) {
  // ...
    value = null; // Value set to null within a catch block
  // ...
}

// possibly within another catch block
value.member += 1; // This is guaranteed to fail with a NPE.

Check usages of the concerned value and ensure that any unchecked usages are corrected.