Try not to dereference null pointers; the loop above might not have run