tags:

views:

114

answers:

2
+2  A: 

your missing an amperstand (&) (is this a typo?)

if (rt1 == null & rt2 == null) // oops!
if (rt1 == null && rt2 == null) // like this....
Muad'Dib
good catch. But fixing this didn't fix the problem.
Kevin
A: 

Sometimes a sort algorithm will end up comparing an object to itself. When this happened, it triggered the code:

if (rt1 == null)
    return -1;

It was this that caused the error. You've got to be sure that you have all cases covered.

And if those x,y values represent points, you might want to check this article on sorting them: http://www.c-sharpcorner.com/UploadFile/mgold/SortedDictionarySample06202007142815PM/SortedDictionarySample.aspx

Michael Dillon
If it is comparing to itself, why would `rt1` be `null`, and it not have already triggered the `return 0` case?
Marc Gravell
I'm assuming that the first if statement is the bit that he added to get rid of the error message.
Michael Dillon
The OP says that was "`if(rt1 == rt2) return 0;`".
Marc Gravell