Fix quality flaws: possible Null Pointer Exception.