Skip to content

Commit

Permalink
Fix described in #263 - null reference exception when the user logs o…
Browse files Browse the repository at this point in the history
…ff of their account when using Canonical, MetaRobots, or Title HTML helpers. Added a guard to check whether the current node is null to the templates.
  • Loading branch information
NightOwl888 committed Jan 7, 2014
1 parent 05113e8 commit b6d2e4b
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<%@ Import Namespace="System.Web.Mvc.Html" %>
<%@ Import Namespace="MvcSiteMapProvider.Web.Html.Models" %>

<% if (!String.IsNullOrEmpty(Model.CurrentNode.CanonicalUrl)) { %>
<% if (Model.CurrentNode != null && !String.IsNullOrEmpty(Model.CurrentNode.CanonicalUrl)) { %>
<link rel="canonical" href="<%=Model.CurrentNode.CanonicalUrl%>" />
<% } %>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
@using System.Web.Mvc.Html
@using MvcSiteMapProvider.Web.Html.Models

@if (!String.IsNullOrEmpty(Model.CurrentNode.CanonicalUrl)) {
@if (Model.CurrentNode != null && !String.IsNullOrEmpty(Model.CurrentNode.CanonicalUrl)) {
<link rel="canonical" href="@Model.CurrentNode.CanonicalUrl" />
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<%@ Import Namespace="System.Web.Mvc.Html" %>
<%@ Import Namespace="MvcSiteMapProvider.Web.Html.Models" %>

<% if (!String.IsNullOrEmpty(Model.CurrentNode.MetaRobotsContent)) { %>
<% if (Model.CurrentNode != null && !String.IsNullOrEmpty(Model.CurrentNode.MetaRobotsContent)) { %>
<meta name="robots" content="<%=Model.CurrentNode.MetaRobotsContent%>" />
<% } %>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
@using System.Web.Mvc.Html
@using MvcSiteMapProvider.Web.Html.Models

@if (!String.IsNullOrEmpty(Model.CurrentNode.MetaRobotsContent)) {
@if (Model.CurrentNode != null && !String.IsNullOrEmpty(Model.CurrentNode.MetaRobotsContent)) {
<meta name="robots" content="@Model.CurrentNode.MetaRobotsContent" />
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
<%@ Import Namespace="System.Web.Mvc.Html" %>
<%@ Import Namespace="MvcSiteMapProvider.Web.Html.Models" %>

<%=Model.CurrentNode.Title%>
<% if (Model.CurrentNode != null) { %>
<%=Model.CurrentNode.Title%>
<% } %>
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
@using System.Web.Mvc.Html
@using MvcSiteMapProvider.Web.Html.Models

@Model.CurrentNode.Title
@if (Model.CurrentNode != null) {Model.CurrentNode.Title;}

0 comments on commit b6d2e4b

Please sign in to comment.