Skip to content

Commit

Permalink
Merge pull request #1001 from perazz/no_empty_deps
Browse files Browse the repository at this point in the history
Ensure no empty dependencies in dependency tree
  • Loading branch information
henilp105 authored Feb 26, 2024
2 parents 9a2849d + 47fcdb3 commit f09d3d8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/fpm/dependency.f90
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,9 @@ recursive subroutine add_project_dependencies(self, package, root, main, error)
end if
end if

!> Ensure allocation fits
call resize(self%dep,self%ndep)

end subroutine add_project_dependencies

!> Add a list of dependencies to the dependency tree
Expand All @@ -430,6 +433,9 @@ subroutine add_dependencies(self, dependency, error)
end do
if (allocated(error)) return

!> Ensure allocation fits ndep
call resize(self%dep,self%ndep)

end subroutine add_dependencies

!> Add a single dependency node to the dependency tree
Expand Down Expand Up @@ -464,6 +470,10 @@ subroutine add_dependency_node(self, dependency, error)
end if
end if
else

!> Safety: reallocate if necessary
if (size(self%dep)==self%ndep) call resize(self%dep,self%ndep+1)

! New dependency: add from scratch
self%ndep = self%ndep + 1
self%dep(self%ndep) = dependency
Expand Down

0 comments on commit f09d3d8

Please sign in to comment.