Skip to content

Commit 6f9c413

Browse files
committed
Fix Pager with no pages
1 parent d8d3107 commit 6f9c413

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Sources/SwiftUIPager/Page.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class Page: ObservableObject {
3737
var totalPages: Int = Int.max {
3838
didSet {
3939
// reset in case there's a deletion
40-
self.index = index
40+
self.index = totalPages > 0 ? index : 0
4141
}
4242
}
4343

0 commit comments

Comments
 (0)