From db36367b11e512cd5a5ecb723e47e190dfa4c7c9 Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Sat, 6 Jul 2019 11:00:31 +0100 Subject: [PATCH] avoid AIOOBE --- core/src/main/groovy/com/muwire/core/download/Pieces.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/groovy/com/muwire/core/download/Pieces.groovy b/core/src/main/groovy/com/muwire/core/download/Pieces.groovy index 95d00f59..a7e0c7e9 100644 --- a/core/src/main/groovy/com/muwire/core/download/Pieces.groovy +++ b/core/src/main/groovy/com/muwire/core/download/Pieces.groovy @@ -43,7 +43,7 @@ class Pieces { for (int i = claimed.nextSetBit(0); i >= 0; i = claimed.nextSetBit(i+1)) available.remove(i) if (available.isEmpty()) - return -1 + return null List toList = available.toList() Collections.shuffle(toList) int rv = toList[0]