Fixed ArrayOutOfBounds on binarySearch of empty list. https://github.com/konsoletyper/teavm/issues/110

This commit is contained in:
Steve Hannah 2015-05-12 16:58:46 -07:00
parent 3564230cf3
commit 7eb710a806

View File

@ -253,6 +253,9 @@ public class TCollections extends TObject {
} }
int l = 0; int l = 0;
int u = list.size() - 1; int u = list.size() - 1;
if (u < 0) {
return -1;
}
while (true) { while (true) {
int i = (l + u) / 2; int i = (l + u) / 2;
T e = list.get(i); T e = list.get(i);