diff --git a/src/io/csv_file.f90 b/src/io/csv_file.f90 index 26be324beee..c7c13bacca6 100644 --- a/src/io/csv_file.f90 +++ b/src/io/csv_file.f90 @@ -308,7 +308,11 @@ function csv_file_count_lines(this) result(n) integer :: n integer :: ierr, file_unit - open(file = trim(this%fname), status = 'old', newunit = file_unit) + call this%check_exists() + + open(file = trim(this%fname), status = 'old', newunit = file_unit, & + iostat = ierr) + if (ierr .ne. 0) call neko_error("Error while opening " // trim(this%fname)) rewind(file_unit) n = 0