Copy entries to local variable

This commit is contained in:
James Newton-King
2018-07-29 12:00:13 +12:00
parent 18cc211d0e
commit 4bb55dc1b6
+2 -1
View File
@@ -78,8 +78,9 @@ namespace Newtonsoft.Json
// make sure index is evaluated before accessing _entries, otherwise potential race condition causing IndexOutOfRangeException // make sure index is evaluated before accessing _entries, otherwise potential race condition causing IndexOutOfRangeException
var index = hashCode & _mask; var index = hashCode & _mask;
var entries = _entries;
for (Entry entry = _entries[index]; entry != null; entry = entry.Next) for (Entry entry = entries[index]; entry != null; entry = entry.Next)
{ {
if (entry.HashCode == hashCode && TextEquals(entry.Value, key, start, length)) if (entry.HashCode == hashCode && TextEquals(entry.Value, key, start, length))
{ {