Call to a member function getVisible() on null