Skip to content

Commit

Permalink
Merge pull request #29 from DavidKmn/go-back-index-check
Browse files Browse the repository at this point in the history
Add index validity check on goBack method
  • Loading branch information
johnpatrickmorgan authored May 23, 2022
2 parents 9acf489 + 2281a6f commit be3c288
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 be3c288

Please sign in to comment.