Skip to content

Commit

Permalink
Merge pull request #637 from xumix/6.2.5
Browse files Browse the repository at this point in the history
Fix dictionary key access
  • Loading branch information
Shazwazza committed Feb 20, 2015
2 parents d54e09c + 03969fd commit 8c13b89
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/umbraco.cms/businesslogic/Dictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ public static DictionaryItem[] getTopMostItems
/// </summary>
public class DictionaryItem
{

private string _key;

internal Guid UniqueId { get; private set; }
Expand All @@ -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;
Expand Down

0 comments on commit 8c13b89

Please sign in to comment.