diff --git a/src/mat73.c b/src/mat73.c index 8237546e..1896e8eb 100644 --- a/src/mat73.c +++ b/src/mat73.c @@ -845,6 +845,10 @@ Mat_H5ReadGroupInfo(mat_t *mat, matvar_t *matvar, hid_t dset_id) return err; } + if (nfields == 0) { + return MATIO_E_GENERIC_READ_ERROR; + } + /* Check if the variable is sparse */ if ( H5Aexists_by_name(dset_id, ".", "MATLAB_sparse", H5P_DEFAULT) ) { herr_t herr;