From 242878a09f2acbc0d078a814ed347515ede54fc7 Mon Sep 17 00:00:00 2001 From: saurabhbhatia Date: Mon, 25 Nov 2013 12:53:57 +0800 Subject: [PATCH] Rescue nil for sitemap --- app/controllers/front_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/front_controller.rb b/app/controllers/front_controller.rb index ec724109..9fb1d5ae 100644 --- a/app/controllers/front_controller.rb +++ b/app/controllers/front_controller.rb @@ -31,10 +31,10 @@ class FrontController < ApplicationController def show_site_sub_menu @page = Page.find(:all, :conditions => {:name => /sitemap/i}) - @name = @page.first.name + @name = @page.first.name if @page.first.present? @url = "/#{@name}" - if !@site.sitemap_menu_in_header + if (!@site.sitemap_menu_in_header && @page.first.present?) render :text => (@site.sub_menu + "Sitemap") else render :text => @site.sub_menu