Skip to content

Commit 4f962b4

Browse files
committed
Manually ported fixes from #4082
1 parent e0a8335 commit 4f962b4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Microsoft.Toolkit.Mvvm/Messaging/Internals/ConditionalWeakTable2{TKey,TValue}.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ public bool MoveNext()
129129

130130
while (node is not null)
131131
{
132+
LinkedListNode<WeakReference<TKey>>? nextNode = node.Next;
133+
132134
// Get the key and value for the current node
133135
if (node.Value.TryGetTarget(out TKey? target) &&
134136
this.owner.table.TryGetValue(target!, out TValue? value))
@@ -144,7 +146,7 @@ public bool MoveNext()
144146
this.owner.keys.Remove(node);
145147
}
146148

147-
node = node.Next;
149+
node = nextNode;
148150
}
149151

150152
return false;

0 commit comments

Comments
 (0)