Commit a99ad3d3 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

tree_heleper: concat html only if present. Avoid nil exception

parent 9ba21dd0
......@@ -13,13 +13,15 @@ module TreeHelper
tree += render partial: 'tree/tree_item', collection: folders, locals: {type: 'folder'} if folders.present?
files.each do |f|
if f.respond_to?(:url)
# Object is a Submodule
tree += render partial: 'tree/submodule_item', object: f
else
# Object is a Blob
tree += render partial: 'tree/tree_item', object: f, locals: {type: 'file'}
end
html = if f.respond_to?(:url)
# Object is a Submodule
render partial: 'tree/submodule_item', object: f
else
# Object is a Blob
render partial: 'tree/tree_item', object: f, locals: {type: 'file'}
end
tree += html if html.present?
end
tree.html_safe
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment