Permalink
Browse files

Fix IndexOutOfBoundsException: toIndex = 65

  • Loading branch information...
1 parent 47e7bdd commit 7e5e744b74da4aae4cdd7c44e71f9154ef965f48 @rahulsom committed Nov 29, 2016
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/main/webapp/WEB-INF/groovy/userlist.groovy
@@ -10,7 +10,11 @@ final int page = params.page ? Integer.parseInt(params.page) : 1
final int start = (page - 1) * PAGESIZE
final int stop = Math.min(start + PAGESIZE - 1, imageList.size() - 1)
log.info "Start: $start, Stop: $stop, ilS: ${imageList.size()}"
-request.setAttribute 'imageList', imageList[start..stop]
+if (start <= stop) {
+ request.setAttribute 'imageList', imageList[start..stop]
+} else {
+ request.setAttribute 'imageList', []
+}
request.setAttribute 'username', userName
if (stop + 1 < imageList.size()) {
request.setAttribute 'next', page + 1

0 comments on commit 7e5e744

Please sign in to comment.