This is an automated email from the ASF dual-hosted git repository.

jdaugherty pushed a commit to branch 8.0.x-hibernate7
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit c88e1dcf1fd4424481084465016643a4e0acbca1
Author: James Daugherty <[email protected]>
AuthorDate: Mon Mar 23 10:53:55 2026 -0400

    Handle null values for SimpleMapQuery
---
 .../grails/datastore/mapping/simple/query/SimpleMapQuery.groovy   | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/grails-data-simple/src/main/groovy/org/grails/datastore/mapping/simple/query/SimpleMapQuery.groovy
 
b/grails-data-simple/src/main/groovy/org/grails/datastore/mapping/simple/query/SimpleMapQuery.groovy
index b542c9f5d6..69f906edaf 100644
--- 
a/grails-data-simple/src/main/groovy/org/grails/datastore/mapping/simple/query/SimpleMapQuery.groovy
+++ 
b/grails-data-simple/src/main/groovy/org/grails/datastore/mapping/simple/query/SimpleMapQuery.groovy
@@ -167,14 +167,14 @@ class SimpleMapQuery extends Query {
 
     private List applyMaxAndOffset(List sortedResults) {
         final def total = sortedResults.size()
-        if (offset >= total) return Collections.emptyList()
+        def from = offset != null ? offset : 0
+        if (from >= total) return Collections.emptyList()
 
         // 0..3
         // 0..-1
         // 1..1
-        def max = this.max // 20
-        def from = offset // 10
-        def to = max == -1 ? -1 : (offset + max) - 1      // 15
+        def max = this.max != null ? this.max : -1
+        def to = max == -1 ? -1 : (from + max) - 1      // 15
         if (to >= total) to = -1
 
         return sortedResults[from..to]

Reply via email to