Improved the "compare result changed" error message to include the most

likely cause of the error.
This commit is contained in:
Paul Speed 2016-11-20 07:14:49 -05:00
parent 7958ae2f46
commit ed817507d4

View File

@ -698,9 +698,11 @@ public class ListSort<T> {
System.arraycopy(arr, iterB, arr, dest, lengthB); System.arraycopy(arr, iterB, arr, dest, lengthB);
// The last element of run A belongs at the end of the merge. // The last element of run A belongs at the end of the merge.
arr[dest + lengthB] = tempArray[iterA]; arr[dest + lengthB] = tempArray[iterA];
} else if(lengthA== 0){ } else if(lengthA == 0){
throw new UnsupportedOperationException("Compare function result changed! " + throw new UnsupportedOperationException("Compare function result changed! " +
"Make sure you do not modify the scene from another thread!"); "Make sure you do not modify the scene from"
+ " another thread and that the comparisons are not based"
+ " on NaN values.");
} else {//Fail label } else {//Fail label
System.arraycopy(tempArray, iterA, arr, dest, lengthA); System.arraycopy(tempArray, iterA, arr, dest, lengthA);
} }