fix out of bound exception

This commit is contained in:
Morten Delenk 2022-08-14 20:58:35 +01:00
parent a8e565ec07
commit 824c552738
No known key found for this signature in database
GPG key ID: 5130416C797067B6

View file

@ -147,7 +147,11 @@ public class CachedClientImpl extends Client {
}
});
}
return Single.just(new Cursor<>(items, Optional.of(String.valueOf(items.get(items.size() - 1).id()))));
Optional<String> next = Optional.empty();
if(items.size() != 0) {
next = Optional.of(String.valueOf(items.get(items.size() - 1).id()));
}
return Single.just(new Cursor<>(items, next));
}
return this.client.getObjects(rect, cont).doOnSuccess(cursor -> {
for (var item : cursor.items()) {