When the data is not correct the generatro should throw an special exeption and allert the user. Currently the execution continue and the error is propagated.
This exception can be a specialized exception for this purpose and using try and catch stop execution and alert the user.