| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -671,6 +671,9 @@ public int size() { | |||
| 671 | 671 | if (useKeys) { | |
| 672 | 672 | return count; // don't worry about NaN values | |
| 673 | 673 | ||
| 674 | + } else if (count == 0) { // skip the NaN check, it'll AIOOBE | ||
| 675 | + return 0; | ||
| 676 | + | ||
| 674 | 677 | } else { // first move NaN values to the end of the list | |
| 675 | 678 | int right = count - 1; | |
| 676 | 679 | while (values[right] != values[right]) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -566,6 +566,10 @@ public void sortReverse() { | |||
| 566 | 566 | new Sort() { | |
| 567 | 567 | @Override | |
| 568 | 568 | public int size() { | |
| 569 | + // if empty, don't even mess with the NaN check, it'll AIOOBE | ||
| 570 | + if (count == 0) { | ||
| 571 | + return 0; | ||
| 572 | + } | ||
| 569 | 573 | // move NaN values to the end of the list and don't sort them | |
| 570 | 574 | int right = count - 1; | |
| 571 | 575 | while (data[right] != data[right]) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments