From 77adb7eb77b35e70c894743e5b08536f56f187bd Mon Sep 17 00:00:00 2001 From: Leandro Nunes dos Santos Date: Fri, 20 May 2016 14:35:52 -0300 Subject: [PATCH] should not raise if there is no block --- footer.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/footer.html.erb b/footer.html.erb index 1394865..00165ba 100644 --- a/footer.html.erb +++ b/footer.html.erb @@ -5,7 +5,7 @@ <% if params[:controller] == 'profile' and params[:action] == 'index' %> <% blocks = profile.blocks blocks.keep_if{|b| b.type == 'CommunityTrackPlugin::TrackListBlock'} - tracks = Block.find(blocks[0].id).tracks + tracks = blocks.empty? ? [] : Block.find(blocks[0].id).tracks stats = {'tracks' => {'comments' => Array.new,'hits' => Array.new}} tracks.each do |t| stats['tracks']['comments'].unshift t.comments_count -- libgit2 0.21.2