Resolving null pointer problems