Need Help with Potential null pointer access

Hello,

I get this warning

VolumioHandler.java:[97,25] Potential null pointer access: this expression has a '@Nullable' type

in this line

How can i solve it?

Assign volumio to a new local variable before doing the null check. Use the local variable everywhere in the method instead of the field.

Rationale: The field can be assigned null by another thread at any moment so it is not safe to use.

1 Like