diff --git a/examples/steepness_train.c b/examples/steepness_train.c index 3d06f277..351ec2d9 100644 --- a/examples/steepness_train.c +++ b/examples/steepness_train.c @@ -29,6 +29,11 @@ void train_on_steepness_file(struct fann *ann, char *filename, unsigned int i; struct fann_train_data *data = fann_read_train_from_file(filename); + if(data == NULL) + { + ann->errno_f = FANN_E_CANT_READ_TD; + return; + } if(epochs_between_reports) { diff --git a/src/fann_cascade.c b/src/fann_cascade.c index 51954907..db7f8f2d 100644 --- a/src/fann_cascade.c +++ b/src/fann_cascade.c @@ -134,6 +134,7 @@ FANN_EXTERNAL void FANN_API fann_cascadetrain_on_file(struct fann *ann, const ch if(data == NULL) { + ann->errno_f = FANN_E_CANT_READ_TD; return; } fann_cascadetrain_on_data(ann, data, max_neurons, neurons_between_reports, desired_error); diff --git a/src/fann_train_data.c b/src/fann_train_data.c index fd706730..ce1e5b97 100644 --- a/src/fann_train_data.c +++ b/src/fann_train_data.c @@ -306,6 +306,7 @@ FANN_EXTERNAL void FANN_API fann_train_on_file(struct fann *ann, const char *fil if(data == NULL) { + ann->errno_f = FANN_E_CANT_READ_TD; return; } fann_train_on_data(ann, data, max_epochs, epochs_between_reports, desired_error);