mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
[Fixes: #7462] Orchard.OutputCache - Possible NRE in DefaultTagCache ctor when accessing the WorkContext (#7463)
Fixes #7462
This commit is contained in:
committed by
Sébastien Ros
parent
d0b65cb60b
commit
5c6dd3e34f
@@ -17,11 +17,13 @@ namespace Orchard.OutputCache.Services {
|
|||||||
var key = shellSettings.Name + ":TagCache";
|
var key = shellSettings.Name + ":TagCache";
|
||||||
var workContext = workContextAccessor.GetContext();
|
var workContext = workContextAccessor.GetContext();
|
||||||
|
|
||||||
_dictionary = workContext.HttpContext.Cache.Get(key) as ConcurrentDictionary<string, HashSet<string>>;
|
if ( workContext != null ) {
|
||||||
|
_dictionary = workContext.HttpContext.Cache.Get(key) as ConcurrentDictionary<string, HashSet<string>>;
|
||||||
|
|
||||||
if (_dictionary == null) {
|
if ( _dictionary == null ) {
|
||||||
_dictionary = new ConcurrentDictionary<string, HashSet<string>>(StringComparer.OrdinalIgnoreCase);
|
_dictionary = new ConcurrentDictionary<string, HashSet<string>>(StringComparer.OrdinalIgnoreCase);
|
||||||
workContext.HttpContext.Cache.Add(key, _dictionary, null, Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.Normal, null);
|
workContext.HttpContext.Cache.Add(key, _dictionary, null, Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.Normal, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user