Skip to content

Commit

Permalink
Initialization errors
Browse files Browse the repository at this point in the history
  • Loading branch information
LivInTheLookingGlass committed Oct 7, 2024
1 parent 6f8e259 commit 188fb2a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion fortran/src/include/utils.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down

0 comments on commit 188fb2a

Please sign in to comment.