diff --git a/umbraco/cms/businesslogic/cache/Cache.cs b/umbraco/cms/businesslogic/cache/Cache.cs index c2e76bc512..9da2d64a07 100644 --- a/umbraco/cms/businesslogic/cache/Cache.cs +++ b/umbraco/cms/businesslogic/cache/Cache.cs @@ -31,14 +31,18 @@ namespace umbraco.cms.businesslogic.cache /// /// Clears the item in umbraco's runtime cache with the given key /// - /// Key - public static void ClearCacheItem(string Key) + /// Key + public static void ClearCacheItem(string key) { - if (System.Web.HttpRuntime.Cache[Key] != null) - { - HttpRuntime.Cache.Remove(Key); - HttpContext.Current.Trace.Warn("Cache", "Item " + Key + " removed from cache"); - } + // NH 10 jan 2012 + // Patch by the always wonderful Stéphane Gay to avoid cache null refs + var cache = HttpRuntime.Cache; + if (cache[key] != null) + { + var context = HttpContext.Current; + if (context != null) + context.Trace.Warn("Cache", "Item " + key + " removed from cache"); + } } diff --git a/umbraco/presentation/web.config b/umbraco/presentation/web.config index 67b49a6f40..a1a5042970 100644 --- a/umbraco/presentation/web.config +++ b/umbraco/presentation/web.config @@ -40,7 +40,7 @@ - +