Crash fix for tab bar indices out of bounds.
This commit is contained in:
parent
b03af42d39
commit
e8553e717e
@ -46,17 +46,19 @@ public extension MVMCoreUISplitViewController {
|
||||
tabBar?.highlightTab(at: index)
|
||||
} else if let index = mvmViewController?.loadObject??.requestParameters?.actionMap?["tabBarIndex"] as? Int {
|
||||
tabBar?.highlightTab(at: index)
|
||||
} else if navigationIndex < tabBarIndices.count {
|
||||
let index = (tabBarIndices[navigationIndex] as! NSNumber).intValue
|
||||
} else if navigationIndex < tabBarIndices.count,
|
||||
let index = (tabBarIndices[navigationIndex] as? NSNumber)?.intValue {
|
||||
tabBar?.highlightTab(at: index)
|
||||
}
|
||||
|
||||
// Store current tab index, so we can switch back when going back in hierarchy.
|
||||
if tabBarIndices.count > 0 {
|
||||
if tabBarIndices.count > navigationIndex {
|
||||
tabBarIndices.removeObjects(in: NSRange(location: navigationIndex, length: tabBarIndices.count - navigationIndex))
|
||||
}
|
||||
if let currentIndex = tabBar?.currentTabIndex() {
|
||||
tabBarIndices.add(NSNumber(integerLiteral: currentIndex))
|
||||
} else {
|
||||
tabBarIndices.add(NSNull())
|
||||
}
|
||||
|
||||
// Show/Hide. In terms of priority, Page > Action > Always Show.
|
||||
|
||||
@ -55,7 +55,7 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) {
|
||||
/// Reference to the tabbar.
|
||||
@property (nullable, weak, nonatomic) UIView <TabBarProtocol>*tabBar;
|
||||
|
||||
/// Tab bar index history.
|
||||
/// Tab bar index history. Contains either indices (0, 1, etc) or NSNull if there was no tab bar indice to set.
|
||||
@property (nonnull, strong, nonatomic) NSMutableArray <NSNumber *>*tabBarIndices;
|
||||
|
||||
// Convenience getter
|
||||
|
||||
Loading…
Reference in New Issue
Block a user