From 188fb2a4088394a9835b471e276b828758df80a9 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sat, 5 Oct 2024 22:57:12 -0500 Subject: [PATCH] Initialization errors --- fortran/src/include/utils.f90 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fortran/src/include/utils.f90 b/fortran/src/include/utils.f90 index 4fed7779..d0310acf 100644 --- a/fortran/src/include/utils.f90 +++ b/fortran/src/include/utils.f90 @@ -50,9 +50,12 @@ function get_answer(id) result(answer) character(len=32) :: val character(len=4) :: id_, type_, length + answer%type = errort + answer%int_value = 0 + answer%string_value = '' + if (id < 1 .or. id > size(cached_answers)) then print *, "Error: ID is out of bounds." - answer%type = errort return end if @@ -63,6 +66,8 @@ function get_answer(id) result(answer) do i=1, size(cached_answers) cached_answers(i)%type = errort + cached_answers(i)%int_value = 0 + cached_answers(i)%string_value = '' end do call get_data_file("answers.tsv", text)