[Mono-bugs] [Bug 332534] IEnumerator. MoveNext for Dictionary throws an Exception when it is at the end of the collection .

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Oct 10 09:48:10 EDT 2007


https://bugzilla.novell.com/show_bug.cgi?id=332534#c2





--- Comment #2 from Adrian Gallero <agallero at netscape.net>  2007-10-10 07:48:09 MST ---
The fix seems ok to me.
Only a small remark:
we have: 
if (++curTableItem >= dictionary.table.Length)return false;

This will work fine, but we are increasing curTableItem each time we call
MoveNext, even if already at eof. While I believe there is no really a
possibility to overflow curtableItem (we should need to call MoveNext millions
of times in a finished enumerator), maybe it is better to make it:

if (curTableItem > dictionary.table.Length) return false;
curTableItem++;

This way calling MoveNext will not have any side effect.
But any patch is fine to me.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list