Commit 77adb7eb77b35e70c894743e5b08536f56f187bd
1 parent
c010d593
Exists in
master
and in
2 other branches
should not raise if there is no block
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
footer.html.erb
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | <% if params[:controller] == 'profile' and params[:action] == 'index' %> |
6 | 6 | <% blocks = profile.blocks |
7 | 7 | blocks.keep_if{|b| b.type == 'CommunityTrackPlugin::TrackListBlock'} |
8 | - tracks = Block.find(blocks[0].id).tracks | |
8 | + tracks = blocks.empty? ? [] : Block.find(blocks[0].id).tracks | |
9 | 9 | stats = {'tracks' => {'comments' => Array.new,'hits' => Array.new}} |
10 | 10 | tracks.each do |t| |
11 | 11 | stats['tracks']['comments'].unshift t.comments_count | ... | ... |