Skip to content

Commit 53a0348

Browse files
committed
more NaN check business
1 parent afe12e9 commit 53a0348

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

core/src/processing/data/FloatDict.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,9 @@ public int size() {
671671
if (useKeys) {
672672
return count; // don't worry about NaN values
673673

674+
} else if (count == 0) { // skip the NaN check, it'll AIOOBE
675+
return 0;
676+
674677
} else { // first move NaN values to the end of the list
675678
int right = count - 1;
676679
while (values[right] != values[right]) {

core/src/processing/data/FloatList.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,10 @@ public void sortReverse() {
566566
new Sort() {
567567
@Override
568568
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+
}
569573
// move NaN values to the end of the list and don't sort them
570574
int right = count - 1;
571575
while (data[right] != data[right]) {

0 commit comments

Comments
 (0)