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 @@
+