Added guard around adding a NULL object to an array