diff --git a/lib/gollum/wiki.rb b/lib/gollum/wiki.rb index 8f042c5b..ea9bddd6 100644 --- a/lib/gollum/wiki.rb +++ b/lib/gollum/wiki.rb @@ -520,11 +520,14 @@ module Gollum # # Returns a flat Array of Gollum::Page instances. def tree_list(ref) - sha = @access.ref_to_sha(ref) - commit = @access.commit(sha) - tree_map_for(sha).inject([]) do |list, entry| - next list unless @page_class.valid_page_name?(entry.name) - list << entry.page(self, commit) + if sha = @access.ref_to_sha(ref) + commit = @access.commit(sha) + tree_map_for(sha).inject([]) do |list, entry| + next list unless @page_class.valid_page_name?(entry.name) + list << entry.page(self, commit) + end + else + [] end end