diff options
author | Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> | 2020-09-04 20:52:50 +0200 |
---|---|---|
committer | Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> | 2020-09-04 20:52:50 +0200 |
commit | 5b833ce91986e6aa9c6d1ba3908a1b593c035fad (patch) | |
tree | 4101ef2ba8aaf7652cf7ac945f5a0030b7209534 | |
parent | fd77e6ba357390ec9a21506315b5578aaff513ce (diff) | |
download | fpm-5b833ce91986e6aa9c6d1ba3908a1b593c035fad.tar.gz fpm-5b833ce91986e6aa9c6d1ba3908a1b593c035fad.zip |
Catch some previously unbound errors
-rw-r--r-- | fpm/src/fpm/manifest/executable.f90 | 4 | ||||
-rw-r--r-- | fpm/src/fpm/manifest/package.f90 | 9 | ||||
-rw-r--r-- | fpm/src/fpm/manifest/test.f90 | 4 |
3 files changed, 15 insertions, 2 deletions
diff --git a/fpm/src/fpm/manifest/executable.f90 b/fpm/src/fpm/manifest/executable.f90 index 704396a..94d4000 100644 --- a/fpm/src/fpm/manifest/executable.f90 +++ b/fpm/src/fpm/manifest/executable.f90 @@ -63,6 +63,10 @@ contains if (allocated(error)) return call get_value(table, "name", self%name) + if (.not.allocated(self%name)) then + call syntax_error(error, "Could not retrieve executable name") + return + end if call get_value(table, "source-dir", self%source_dir, "app") call get_value(table, "main", self%main, "main.f90") diff --git a/fpm/src/fpm/manifest/package.f90 b/fpm/src/fpm/manifest/package.f90 index f318ad7..95194d2 100644 --- a/fpm/src/fpm/manifest/package.f90 +++ b/fpm/src/fpm/manifest/package.f90 @@ -93,6 +93,10 @@ contains if (allocated(error)) return call get_value(table, "name", self%name) + if (.not.allocated(self%name)) then + call syntax_error(error, "Could not retrieve package name") + return + end if call get_value(table, "dependencies", child, requested=.false.) if (associated(child)) then @@ -110,6 +114,7 @@ contains if (associated(child)) then allocate(self%library) call new_library(self%library, child, error) + if (allocated(error)) return end if call get_value(table, "executable", children, requested=.false.) @@ -125,6 +130,7 @@ contains call new_executable(self%executable(ii), node, error) if (allocated(error)) exit end do + if (allocated(error)) return end if call get_value(table, "test", children, requested=.false.) @@ -140,6 +146,7 @@ contains call new_test(self%test(ii), node, error) if (allocated(error)) exit end do + if (allocated(error)) return end if end subroutine new_package @@ -154,14 +161,12 @@ contains !> Error handling type(error_t), allocatable, intent(out) :: error - character(len=:), allocatable :: name type(toml_key), allocatable :: list(:) logical :: name_present integer :: ikey name_present = .false. - call table%get_key(name) call table%get_keys(list) if (.not.allocated(list)) then diff --git a/fpm/src/fpm/manifest/test.f90 b/fpm/src/fpm/manifest/test.f90 index 9b50315..c35ea63 100644 --- a/fpm/src/fpm/manifest/test.f90 +++ b/fpm/src/fpm/manifest/test.f90 @@ -56,6 +56,10 @@ contains if (allocated(error)) return call get_value(table, "name", self%name) + if (.not.allocated(self%name)) then + call syntax_error(error, "Could not retrieve test name") + return + end if call get_value(table, "source-dir", self%source_dir, "test") call get_value(table, "main", self%main, "main.f90") |