Fix possible NULL pointer reference.