Added a missing null check