Skip to content

Commit

Permalink
Add index validity check on goBack method
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidKmn committed May 23, 2022
1 parent 66914e1 commit 2281a6f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Sources/FlowStacks/RoutableCollection+utilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public extension RoutableCollection where Element: RouteProtocol {
/// Goes back a given number of screens off the stack
/// - Parameter count: The number of screens to go back. Defaults to 1.
mutating func goBack(_ count: Int = 1) {
guard self.count - count >= 0 else { return }
removeLast(count)
}

Expand Down

0 comments on commit 2281a6f

Please sign in to comment.