Merge pull request #637 from xumix/6.2.5

Fix dictionary key access
This commit is contained in:
Shannon Deminick
2015-02-20 09:36:20 +01:00

View File

@@ -93,7 +93,6 @@ namespace umbraco.cms.businesslogic
/// </summary>
public class DictionaryItem
{
private string _key;
internal Guid UniqueId { get; private set; }
@@ -118,13 +117,12 @@ namespace umbraco.cms.businesslogic
{
EnsureCache();
var item = DictionaryItems.Values.SingleOrDefault(x => x.key == key);
if (item == null)
if (!DictionaryItems.ContainsKey(key))
{
throw new ArgumentException("No key " + key + " exists in dictionary");
}
var item = DictionaryItems[key];
this.id = item.id;
this._key = item.key;
this.ParentId = item.ParentId;