From 294c2f4fbab52e69f78f25f39d4e39233c2b3fa5 Mon Sep 17 00:00:00 2001 From: Shannon Deminick Date: Thu, 2 May 2013 14:24:27 -1000 Subject: [PATCH] Fixes: #U4-2183 - null check on UmbracoContext and fixes bad merge issue, the UserTypeCacheRefresher got removed from the proj file. --- src/Umbraco.Web/Cache/ContentTypeCacheRefresher.cs | 10 ++++++---- src/Umbraco.Web/Cache/DomainCacheRefresher.cs | 10 ++++++---- src/Umbraco.Web/Umbraco.Web.csproj | 1 + 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Umbraco.Web/Cache/ContentTypeCacheRefresher.cs b/src/Umbraco.Web/Cache/ContentTypeCacheRefresher.cs index c724bc4c22..f1a97dc767 100644 --- a/src/Umbraco.Web/Cache/ContentTypeCacheRefresher.cs +++ b/src/Umbraco.Web/Cache/ContentTypeCacheRefresher.cs @@ -215,10 +215,12 @@ namespace Umbraco.Web.Cache // zpqrtbnk: no, not here, in fact the caches should subsribe to refresh events else we // are creating a nasty dependency - but keep it like that for the time being while // SD is cleaning cache refreshers up. - - var contentCache = UmbracoContext.Current.ContentCache.InnerCache as PublishedContentCache; - if (contentCache != null) - contentCache.RoutesCache.Clear(); + if (UmbracoContext.Current != null) + { + var contentCache = UmbracoContext.Current.ContentCache.InnerCache as PublishedContentCache; + if (contentCache != null) + contentCache.RoutesCache.Clear(); + } } } } diff --git a/src/Umbraco.Web/Cache/DomainCacheRefresher.cs b/src/Umbraco.Web/Cache/DomainCacheRefresher.cs index 3d998ae718..f5f0fb442b 100644 --- a/src/Umbraco.Web/Cache/DomainCacheRefresher.cs +++ b/src/Umbraco.Web/Cache/DomainCacheRefresher.cs @@ -47,10 +47,12 @@ namespace Umbraco.Web.Cache // zpqrtbnk: no, not here, in fact the caches should subsribe to refresh events else we // are creating a nasty dependency - but keep it like that for the time being while // SD is cleaning cache refreshers up. - - var contentCache = UmbracoContext.Current.ContentCache.InnerCache as PublishedContentCache; - if (contentCache != null) - contentCache.RoutesCache.Clear(); + if (UmbracoContext.Current != null) + { + var contentCache = UmbracoContext.Current.ContentCache.InnerCache as PublishedContentCache; + if (contentCache != null) + contentCache.RoutesCache.Clear(); + } } } } \ No newline at end of file diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index a34b490b7e..7663e1e43a 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -282,6 +282,7 @@ +