diff --git a/src/templates_hdf5/templator_hdf5.org b/src/templates_hdf5/templator_hdf5.org index 7da1889..f119ec7 100644 --- a/src/templates_hdf5/templator_hdf5.org +++ b/src/templates_hdf5/templator_hdf5.org @@ -123,7 +123,7 @@ trexio_exit_code trexio_hdf5_init(trexio_t* const file) { f->$group$_group = H5Gcreate(f->file_id, $GROUP$_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); break; } - assert (f->$group$_group > 0L); + if (f->$group$_group <= 0L) return TREXIO_INVALID_ID; return TREXIO_SUCCESS; } diff --git a/src/templates_text/templator_text.org b/src/templates_text/templator_text.org index 103a330..aa00eec 100644 --- a/src/templates_text/templator_text.org +++ b/src/templates_text/templator_text.org @@ -441,7 +441,7 @@ trexio_exit_code trexio_text_flush_$group$(trexio_text_t* const file) { if ($group$->to_flush == 0) return TREXIO_SUCCESS; FILE* f = $group$->file; - assert (f != NULL); + if (f == NULL) return TREXIO_INVALID_ARG_1; fseek(f, 0L, SEEK_SET); /* Write the dimensioning variables */