Ensure index > 0 for those tricky ones.
This commit is contained in:
parent
21f24b2c9b
commit
8b64b2b52a
@ -84,8 +84,8 @@ import VDSColorTokens
|
||||
// MARK: - TabBarProtocol
|
||||
@MainActor
|
||||
public func highlightTab(at index: Int) {
|
||||
guard let items = items, index < items.count else {
|
||||
MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Tab index \(index) is greater than the number of tabs available \(items?.count ?? 0).", code: 0, domain: ErrorDomainSystem, location: #function)!)
|
||||
guard let items = items, index >= 0, index < items.count else {
|
||||
MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Invalid tab index \(index). \(items?.count ?? 0) tabs available .", code: 0, domain: ErrorDomainSystem, location: #function)!)
|
||||
return
|
||||
}
|
||||
tabModel.selectedTab = index
|
||||
@ -94,8 +94,8 @@ import VDSColorTokens
|
||||
|
||||
@MainActor
|
||||
public func selectTab(at index: Int) {
|
||||
guard let items = items, index < items.count else {
|
||||
MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Tab index \(index) is greater than the number of tabs available \(items?.count ?? 0).", code: 0, domain: ErrorDomainSystem, location: #function)!)
|
||||
guard let items = items, index >= 0, index < items.count else {
|
||||
MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Invalid tab index \(index). \(items?.count ?? 0) tabs available.", code: 0, domain: ErrorDomainSystem, location: #function)!)
|
||||
return
|
||||
}
|
||||
selectedItem = items[index]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user