From 03969fd687c79af8d5935e5da7f269a6e34984f2 Mon Sep 17 00:00:00 2001 From: Vilen Tambovtsev Date: Fri, 13 Feb 2015 12:21:16 +0300 Subject: [PATCH] Fix dictionary key access Looks like someone does not know how to use a dictionary --- src/umbraco.cms/businesslogic/Dictionary.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/umbraco.cms/businesslogic/Dictionary.cs b/src/umbraco.cms/businesslogic/Dictionary.cs index cd32162fa7b5..872c8e0e923e 100644 --- a/src/umbraco.cms/businesslogic/Dictionary.cs +++ b/src/umbraco.cms/businesslogic/Dictionary.cs @@ -93,7 +93,6 @@ public static DictionaryItem[] getTopMostItems /// public class DictionaryItem { - private string _key; internal Guid UniqueId { get; private set; } @@ -118,13 +117,12 @@ public DictionaryItem(string key) { 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;