Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Guard for `hash_tree` returnin nil

Henriette Dargef0caf8e365fc
diff --git a/app/components/admin/custom_fields/hierarchy/tree_view_component.rb b/app/components/admin/custom_fields/hierarchy/tree_view_component.rb
index c29fac1f2f3..e99ab023524 100644
--- a/app/components/admin/custom_fields/hierarchy/tree_view_component.rb
+++ b/app/components/admin/custom_fields/hierarchy/tree_view_component.rb
@@ -41,7 +41,8 @@ module Admin
end
def hierarchy_items
- @custom_field.hierarchy_root.hash_tree.first[1]
+ hashed_hierarchy = @custom_field.hierarchy_root.hash_tree
+ hashed_hierarchy.nil? ? {} : hashed_hierarchy.first[1]
end
def add_sub_tree(tree, hierarchy_hash)