From 75195331070be81f5ddbbd2ae175395beb67a786 Mon Sep 17 00:00:00 2001 From: Manson Wang Date: Fri, 15 Nov 2013 09:53:24 +0800 Subject: [PATCH] Fix Gallery frontend controller crash when albun.tag_ids is empty --- .../controllers/panel/gallery/front_end/albums_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/front_end/albums_controller.rb b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/front_end/albums_controller.rb index 01e19382e..4d1935674 100644 --- a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/front_end/albums_controller.rb +++ b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/front_end/albums_controller.rb @@ -46,7 +46,8 @@ class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController @album = GalleryAlbum.find(@albumid) @images = @album.gallery_images.all tags = @album.tag_ids - @tagnames = Tag.find(tags.tagged_ids).map{|t| t.name} + @tagnames = [] if tags.blank? + @tagnames = Tag.find(tags.tagged_ids).map{|t| t.name} if !tags.blank? @back_link = panel_gallery_front_end_album_path(@albumid) end end