Skip to content

Commit

Permalink
Patch toml_error
Browse files Browse the repository at this point in the history
  • Loading branch information
perazz committed Mar 25, 2024
1 parent 7dc0171 commit 9dd4487
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/fpm/toml.f90
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ subroutine load_from_unit(self, unit, error, json)
!> Optional JSON format
logical, optional, intent(in) :: json

type(toml_error), allocatable :: toml_error
type(toml_error), allocatable :: local_error
type(toml_table), allocatable :: table
type(toml_table), pointer :: jtable
class(toml_value), allocatable :: object
Expand All @@ -267,10 +267,10 @@ subroutine load_from_unit(self, unit, error, json)
if (is_json) then

!> init JSON interpreter
call json_load(object, unit, error=toml_error)
if (allocated(toml_error)) then
call json_load(object, unit, error=local_error)
if (allocated(local_error)) then
allocate (error)
call move_alloc(toml_error%message, error%message)
call move_alloc(local_error%message, error%message)
return
end if

Expand All @@ -286,11 +286,11 @@ subroutine load_from_unit(self, unit, error, json)
else

!> use default TOML parser
call toml_load(table, unit, error=toml_error)
call toml_load(table, unit, error=local_error)

if (allocated(toml_error)) then
if (allocated(local_error)) then
allocate (error)
call move_alloc(toml_error%message, error%message)
call move_alloc(local_error%message, error%message)
return
end if

Expand Down

0 comments on commit 9dd4487

Please sign in to comment.