# HG changeset patch # User IBBoard # Date 1231270067 0 # Node ID 6b762694f05175d3e25667589caa647c3fad4200 # Parent 465b672e9682211cfb7da8f8188692ef94de5033 Check size of dictionary so that we don't have to get the values when we've got an empty dictionary no-open-ticket diff -r 465b672e9682 -r 6b762694f051 Collections/DictionaryToArrayConverter.cs --- a/Collections/DictionaryToArrayConverter.cs Sun Jan 04 18:45:32 2009 +0000 +++ b/Collections/DictionaryToArrayConverter.cs Tue Jan 06 19:27:47 2009 +0000 @@ -41,8 +41,14 @@ return null; } - VALUE_TYPE[] col = new VALUE_TYPE[dictionary.Count]; - dictionary.Values.CopyTo(col, 0); + int entryCount = dictionary.Count; + VALUE_TYPE[] col = new VALUE_TYPE[entryCount]; + + if (entryCount > 0) + { + dictionary.Values.CopyTo(col, 0); + } + return col; } }