Add a small null-pointer check.