Refactor conditional statement for if statement that involves null.