fix: prevent negative slice index when last exceeds items count

This commit is contained in:
argoyle committed 2026-01-01 15:09:00 +01:00
1 parent 02405c5ce1
commit bead25aa6b
2 files changed
+14

No files matched your search

+3
View File
@@ -64,6 +64,9 @@ func GetPage[T any](items []T, first *int, after *string, last *int, before *str
} else if last != nil {
tmp = *last
sIx = len(items) - tmp
if sIx < 0 {
sIx = 0
}
eIx = len(items)
}
if cursor, err := DecodeCursor(after); err == nil && cursor != "" {