MasterTabBarController: Add sanity checks when add or remove a session. Fix runtime issue with Xcode 12.5 and NSArray mismatch type with Swift (see https://forums.swift.org/t/objective-c-interoperability-type-mismatch/12464 for more information).

This commit is contained in:
SBiOSoftWhare
2021-06-07 16:20:49 +02:00
parent f1ae5070e3
commit 931d3af9d9
2 changed files with 12 additions and 6 deletions
@@ -356,6 +356,12 @@
- (void)addMatrixSession:(MXSession *)mxSession
{
if ([mxSessionArray containsObject:mxSession])
{
MXLogDebug(@"MasterTabBarController already has %@ in mxSessionArray", mxSession)
return;
}
// Check whether the controller'€™s view is loaded into memory.
if (self.homeViewController)
{
@@ -394,6 +400,12 @@
- (void)removeMatrixSession:(MXSession *)mxSession
{
if (![mxSessionArray containsObject:mxSession])
{
MXLogDebug(@"MasterTabBarController does not contain %@ in mxSessionArray", mxSession)
return;
}
[recentsDataSource removeMatrixSession:mxSession];
// Check whether there are others sessions