Call to a member function addError() on null