Guarding against a nil pointer