Added a missing NULL check.