Skip to content

Commit 3e9ce32

Browse files
matthew-longgraemerocher
authored andcommitted
Fix IndexOutOfBoundsException with offset (#1273)
Pagination logic was being performed when offset == total, instead an empty list should be returned.
1 parent 6e6dbaa commit 3e9ce32

File tree

1 file changed

+1
-1
lines changed
  • grails-datastore-gorm-test/src/main/groovy/org/grails/datastore/mapping/simple/query

1 file changed

+1
-1
lines changed

grails-datastore-gorm-test/src/main/groovy/org/grails/datastore/mapping/simple/query/SimpleMapQuery.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ class SimpleMapQuery extends Query {
162162

163163
private List applyMaxAndOffset(List sortedResults) {
164164
final def total = sortedResults.size()
165-
if (offset > total) return Collections.emptyList()
165+
if (offset >= total) return Collections.emptyList()
166166

167167
// 0..3
168168
// 0..-1

0 commit comments

Comments
 (0)