fix code review:  Correctness - Possible null pointer dereference