修复了一些可能数组越界的问题

This commit is contained in:
fengshuo
2023-01-04 14:43:47 +08:00
parent 2a01188251
commit 81d7066ecb
22 changed files with 61 additions and 41 deletions

View File

@@ -10,6 +10,7 @@
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "NSArray+Safe.h"
///View
#import "XPMineDataSkillDataCollectionViewCell.h"
@@ -78,14 +79,14 @@
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
XPMineDataSkillDataCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPMineDataSkillDataCollectionViewCell class]) forIndexPath:indexPath];
cell.skillInfo = [self.datasourece objectAtIndex:indexPath.row];
cell.skillInfo = [self.datasourece safeObjectAtIndex1:indexPath.row];
return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
[collectionView deselectItemAtIndexPath:indexPath animated:YES];
if (self.datasourece.count > 0) {
MineSkillCardListInfoModel * skillInfo = [self.datasourece objectAtIndex:indexPath.row];
MineSkillCardListInfoModel * skillInfo = [self.datasourece safeObjectAtIndex1:indexPath.row];
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineDataSkillCardTableViewCell:didSelectItem:)]) {
[self.delegate xPMineDataSkillCardTableViewCell:self didSelectItem:skillInfo];
}

View File

@@ -12,6 +12,7 @@
#import "ThemeColor.h"
#import "XPMacro.h"
#import "UIImage+Utils.h"
#import "NSArray+Safe.h"
///View
#import "XPMIneGameCollectionViewCell.h"
@@ -75,7 +76,7 @@
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
XPMIneGameCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPMIneGameCollectionViewCell class]) forIndexPath:indexPath];
LittleGameInfoModel * item = [self.datasource objectAtIndex:indexPath.row];
LittleGameInfoModel * item = [self.datasource safeObjectAtIndex1:indexPath.row];
cell.gameModel = item;
return cell;
}
@@ -83,7 +84,7 @@
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
[collectionView deselectItemAtIndexPath:indexPath animated:YES];
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineGameTableViewCell:didSelectItem:)]) {
LittleGameInfoModel * model = [self.datasource objectAtIndex:indexPath.row];
LittleGameInfoModel * model = [self.datasource safeObjectAtIndex1:indexPath.row];
[self.delegate xPMineGameTableViewCell:self didSelectItem:model];
}
}

View File

@@ -11,6 +11,7 @@
///Tool
#import "ThemeColor.h"
#import "XPMacro.h"
#import "NSArray+Safe.h"
///View
#import "XPMineHeadItemCollectionViewCell.h"
#import "XPMineHeadFunctionItemLayout.h"
@@ -61,7 +62,7 @@
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
XPMineHeadItemCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPMineHeadItemCollectionViewCell class]) forIndexPath:indexPath];
XPMineFuntionItemModel * item = [self.datasource objectAtIndex:indexPath.row];
XPMineFuntionItemModel * item = [self.datasource safeObjectAtIndex1:indexPath.row];
cell.itemModel = item;
return cell;
}
@@ -69,7 +70,7 @@
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
[collectionView deselectItemAtIndexPath:indexPath animated:YES];
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineHeadItemTableViewCell:didSelectItem:)]) {
XPMineFuntionItemModel * model = [self.datasource objectAtIndex:indexPath.row];
XPMineFuntionItemModel * model = [self.datasource safeObjectAtIndex1:indexPath.row];
[self.delegate xPMineHeadItemTableViewCell:self didSelectItem:model];
}
}

View File

@@ -12,6 +12,7 @@
#import "ThemeColor.h"
#import "XPMacro.h"
#import "Api+DressUp.h"
#import "NSArray+Safe.h"
///Model
#import "HomeSearchResultModel.h"
///View
@@ -91,7 +92,7 @@
if (cell == nil) {
cell = [[XPDressShopSearchTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPDressShopSearchTableViewCell class])];
}
HomeSearchResultModel * resultModel = [self.datasource objectAtIndex:indexPath.row];
HomeSearchResultModel * resultModel = [self.datasource safeObjectAtIndex1:indexPath.row];
cell.data = resultModel;
cell.delegate = self;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
@@ -105,7 +106,7 @@
#pragma mark - XPDressShopSearchTableViewCellDelegate
- (void)xPDressShopSearchTableViewCellSendButtonClick:(XPDressShopSearchTableViewCell *)cell {
NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
HomeSearchResultModel * resultModel = [self.datasource objectAtIndex:indexPath.row];
HomeSearchResultModel * resultModel = [self.datasource safeObjectAtIndex1:indexPath.row];
[self showLoading];
[Api requestSendDress:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
[self hideHUD];

View File

@@ -10,6 +10,7 @@
#import <Masonry/Masonry.h>
///Tool
#import "XPMacro.h"
#import "NSArray+Safe.h"
///View
#import "XPMineDressEmptyTableViewCell.h"
#import "XPDressUpShopCardTableViewCell.h"
@@ -154,7 +155,7 @@
if (cell == nil) {
cell = [[XPDressUpShopCardTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPDressUpShopCardTableViewCell class])];
}
cell.nobleCardModel = [self.datasource objectAtIndex:indexPath.row];
cell.nobleCardModel = [self.datasource safeObjectAtIndex1:indexPath.row];
cell.delegate = self;
return cell;
}

View File

@@ -10,6 +10,7 @@
#import <Masonry/Masonry.h>
///Tool
#import "XPMacro.h"
#import "NSArray+Safe.h"
///View
#import "XPMineDressEmptyCollectionViewCell.h"
#import "XPDressUpShopCollectionViewCell.h"
@@ -145,7 +146,7 @@
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
if (self.datasource.count > 0) {
XPDressUpShopCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPDressUpShopCollectionViewCell class]) forIndexPath:indexPath];
cell.dressUpModel = [self.datasource objectAtIndex:indexPath.row];
cell.dressUpModel = [self.datasource safeObjectAtIndex1:indexPath.row];
cell.delegate = self;
return cell;
}

View File

@@ -17,6 +17,7 @@
#import "XPMacro.h"
#import "UIImage+Utils.h"
#import "AccountInfoStorage.h"
#import "NSArray+Safe.h"
///Model
#import "ActivityInfoModel.h"
#import "WalletInfoModel.h"
@@ -219,7 +220,7 @@
#pragma mark - SDCycleScrollViewDelegate
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index {
if (self.activityList.count > index) {
ActivityInfoModel * info = [self.activityList objectAtIndex:index];
ActivityInfoModel * info = [self.activityList safeObjectAtIndex1:index];
if (info.skipType == ActivitySkipType_Room) {
[XPRoomViewController openRoom:info.skipUri viewController:self.navigationController];
} else if(info.skipType == ActivitySkipType_Web) {

View File

@@ -10,6 +10,7 @@
#import <Masonry/Masonry.h>
///Tool
#import "XPMacro.h"
#import "NSArray+Safe.h"
///View
#import "XPMineDressBubbleCollectionViewCell.h"
#import "XPMineDressEmptyCollectionViewCell.h"
@@ -93,7 +94,7 @@
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
if (self.datasource.count > 0) {
XPMineDressBubbleCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPMineDressBubbleCollectionViewCell class]) forIndexPath:indexPath];
cell.bubbleModel = [self.datasource objectAtIndex:indexPath.row];
cell.bubbleModel = [self.datasource safeObjectAtIndex1:indexPath.row];
cell.delegate = self;
return cell;
}

View File

@@ -10,6 +10,7 @@
#import <Masonry/Masonry.h>
///Tool
#import "XPMacro.h"
#import "NSArray+Safe.h"
///View
#import "XPMineHeadwearTableViewCell.h"
#import "XPMineCarTableViewCell.h"
@@ -151,7 +152,7 @@
if (cell == nil) {
cell = [[XPMineHeadwearTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineHeadwearTableViewCell class])];
}
cell.headwearModel = [self.datasource objectAtIndex:indexPath.row];
cell.headwearModel = [self.datasource safeObjectAtIndex1:indexPath.row];
cell.delegate = self;
return cell;
} else if(self.type == DressUpListType_Car) {
@@ -159,7 +160,7 @@
if (cell == nil) {
cell = [[XPMineCarTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineCarTableViewCell class])];
}
cell.carInfo = [self.datasource objectAtIndex:indexPath.row];
cell.carInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
cell.delegate = self;
return cell;
} else if (self.type == DressUpListType_Noble) {
@@ -167,7 +168,7 @@
if (cell == nil) {
cell = [[XPMineNobleCardTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineNobleCardTableViewCell class])];
}
cell.nobleCardModel = [self.datasource objectAtIndex:indexPath.row];
cell.nobleCardModel = [self.datasource safeObjectAtIndex1:indexPath.row];
cell.delegate = self;
return cell;
} else {
@@ -175,7 +176,7 @@
if (cell == nil) {
cell = [[XPMineNameplateTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineNameplateTableViewCell class])];
}
cell.nameplateModel = [self.datasource objectAtIndex:indexPath.row];
cell.nameplateModel = [self.datasource safeObjectAtIndex1:indexPath.row];
cell.delegate = self;
return cell;
}

View File

@@ -14,6 +14,7 @@
///Tool
#import "ThemeColor.h"
#import "Api+DressUp.h"
#import "NSArray+Safe.h"
///Model
#import "ActivityInfoModel.h"
///View
@@ -141,7 +142,7 @@
#pragma mark - SDCycleScrollViewDelegate
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index {
if (self.activityList.count > index) {
ActivityInfoModel * info = [self.activityList objectAtIndex:index];
ActivityInfoModel * info = [self.activityList safeObjectAtIndex1:index];
if (info.skipType == ActivitySkipType_Room) {
[XPRoomViewController openRoom:info.skipUri viewController:self.navigationController];
} else if(info.skipType == ActivitySkipType_Web) {

View File

@@ -80,14 +80,14 @@
if (cell == nil) {
cell = [[XPMatchManageTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMatchManageTableViewCell class])];
}
XPMineItemModel * item = [self.matchItemArray objectAtIndex:indexPath.row];
XPMineItemModel * item = [self.matchItemArray safeObjectAtIndex1:indexPath.row];
cell.itemModel = item;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
XPMineItemModel * model = [self.matchItemArray objectAtIndex:indexPath.row];
XPMineItemModel * model = [self.matchItemArray safeObjectAtIndex1:indexPath.row];
[self pushViewControllerWithType:model.type];
}

View File

@@ -15,6 +15,7 @@
#import "YYUtility.h"
///Tool
#import "ThemeColor.h"
#import "NSArray+Safe.h"
///Model
#import "UserInfoModel.h"
///View
@@ -139,7 +140,7 @@
cell.isEdit = NO;
} else {
if (self.datasource.count > 0) {
cell.photo = [self.datasource objectAtIndex:indexPath.row - 1];
cell.photo = [self.datasource safeObjectAtIndex1:indexPath.row - 1];
cell.isEdit = self.isEdit;
}
}

View File

@@ -14,6 +14,7 @@
#import "TTPopup.h"
#import "YYUtility.h"
#import "XPMacro.h"
#import "NSArray+Safe.h"
///Model
#import "XPMineUserInfoEditModel.h"
#import "UserInfoModel.h"
@@ -137,7 +138,7 @@
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
XPMineUserInfoEditModel * model = [self.datasouce objectAtIndex:indexPath.row];
XPMineUserInfoEditModel * model = [self.datasouce safeObjectAtIndex1:indexPath.row];
if (model.type == XPMineUserInfoEditType_Avatar) {
return 60;
} else {
@@ -150,14 +151,14 @@
if (cell == nil) {
cell = [[XPMineUserInfoEditTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineUserInfoEditTableViewCell class])];
}
XPMineUserInfoEditModel * model = [self.datasouce objectAtIndex:indexPath.row];
XPMineUserInfoEditModel * model = [self.datasouce safeObjectAtIndex1:indexPath.row];
cell.itmeModel = model;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
XPMineUserInfoEditModel * model = [self.datasouce objectAtIndex:indexPath.row];
XPMineUserInfoEditModel * model = [self.datasouce safeObjectAtIndex1:indexPath.row];
switch (model.type) {
case XPMineUserInfoEditType_Nick:
{

View File

@@ -11,6 +11,7 @@
///Tool
#import "ThemeColor.h"
#import "XPMacro.h"
#import "NSArray+Safe.h"
///View
#import "XPMineUserInfoGiftWallCollectionViewCell.h"
#import "XPGuildEmptyCollectionViewCell.h"
@@ -59,7 +60,7 @@
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
if (self.datasource.count > 0) {
XPMineUserInfoGiftWallCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPMineUserInfoGiftWallCollectionViewCell class]) forIndexPath:indexPath];
UserGiftWallInfoModel * giftInfo = [self.datasource objectAtIndex:indexPath.row];
UserGiftWallInfoModel * giftInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
cell.giftInfo = giftInfo;
return cell;

View File

@@ -10,6 +10,7 @@
#import <Masonry/Masonry.h>
///Tool
#import "XPMacro.h"
#import "NSArray+Safe.h"
///View
#import "XPMineDataGiftCollectionViewCell.h"
#import "XPMineUserInfoEmptyCollectionViewCell.h"
@@ -53,7 +54,7 @@
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
if (self.datasource.count > 0) {
XPMineDataGiftCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPMineDataGiftCollectionViewCell class]) forIndexPath:indexPath];
cell.giftInfo = [self.datasource objectAtIndex:indexPath.row];
cell.giftInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
return cell;
}

View File

@@ -17,6 +17,7 @@
#import "UIImage+ImageEffects.h"
#import "UIImage+Utils.h"
#import "NetImageView.h"
#import "NSArray+Safe.h"
///Model
#import "UserInfoModel.h"
@@ -265,7 +266,7 @@
#pragma mark - SDPhotoBrowserDelegate
- (NSURL *)photoBrowser:(SDPhotoBrowser *)browser highQualityImageURLForIndex:(NSInteger)index {
NSString * photoUrl = [self.imageUrls objectAtIndex:index];
NSString * photoUrl = [self.imageUrls safeObjectAtIndex1:index];
return [NSURL URLWithString:photoUrl];
}
@@ -276,7 +277,7 @@
#pragma mark - SDCycleScrollViewDelegate
-(void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didScrollToIndex:(NSInteger)index {
[self.pageButton setTitle:[NSString stringWithFormat:@"%ld/%lu",(index + 1), (unsigned long)self.imageUrls.count] forState:UIControlStateNormal];
UserPhoto * photo = [self.userPhtotArray objectAtIndex:index];
UserPhoto * photo = [self.userPhtotArray safeObjectAtIndex1:index];
self.reviewIcon.hidden = !photo.isReview;
}
@@ -358,7 +359,7 @@
}
if (self.userInfo.privatePhoto.count > 0) {
for (int i = 0; i < self.userInfo.privatePhoto.count; i++) {
UserPhoto * photo = [self.userInfo.privatePhoto objectAtIndex:i];
UserPhoto * photo = [self.userInfo.privatePhoto safeObjectAtIndex1:i];
if (photo.photoUrl.length > 0) {
[self.userPhtotArray addObject:photo];
[imageUrls addObject:photo.photoUrl];

View File

@@ -13,6 +13,7 @@
#import "UIImage+Utils.h"
#import "UIButton+EnlargeTouchArea.h"
#import "ThemeColor.h"
#import "NSArray+Safe.h"
///Model
#import "MineSkillCardListInfoModel.h"
#import "XPSkillCardPlayerManager.h"
@@ -75,7 +76,7 @@
if (!self.isPlaying) {
if(self.voiceInfo.propVals.count) {
// NSString *fileName = [[self.voiceInfo.name componentsSeparatedByString:@"/"] lastObject];
NSString * url = [self.voiceInfo.propVals objectAtIndex:0];
NSString * url = [self.voiceInfo.propVals safeObjectAtIndex1:0];
NSArray * nameArray = [url componentsSeparatedByString:@"/"];
NSString * fileName = @"daeplay";
if (nameArray.count > 0) {

View File

@@ -10,6 +10,7 @@
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "NSArray+Safe.h"
///Model
#import "XPMineAnchorFansTeamModel.h"
///View
@@ -79,7 +80,7 @@
if (cell == nil) {
cell = [[XPMineAnchorFansTeamTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineAnchorFansTeamTableViewCell class])];
}
cell.item = [self.datasource objectAtIndex:indexPath.row];
cell.item = [self.datasource safeObjectAtIndex1:indexPath.row];
return cell;
}
@@ -92,7 +93,7 @@
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
XPMineAnchorFansTeamModel *item = [self.datasource objectAtIndex:indexPath.row];
XPMineAnchorFansTeamModel *item = [self.datasource safeObjectAtIndex1:indexPath.row];
XPMineUserInfoViewController * userInfoVC = [[XPMineUserInfoViewController alloc] init];
userInfoVC.uid = item.teamUid;
[self.navigationController pushViewController:userInfoVC animated:YES];

View File

@@ -151,7 +151,7 @@
if (cell == nil) {
cell = [[XPMineFootPrintTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineFootPrintTableViewCell class])];
}
cell.item = [self.datasource objectAtIndex:indexPath.row];
cell.item = [self.datasource safeObjectAtIndex1:indexPath.row];
return cell;
}
@@ -167,12 +167,12 @@
[tableView setEditing:NO animated:YES];
__weak typeof(self) weakSelf = self;
UIContextualAction *deleteAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
XPMineFootPrintModel *item = [weakSelf.datasource objectAtIndex:indexPath.row];
XPMineFootPrintModel *item = [weakSelf.datasource safeObjectAtIndex1:indexPath.row];
[weakSelf.presenter cleanFootPrint:item.roomUid];
completionHandler(true);
}];
UIContextualAction *collectAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"收藏" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
XPMineFootPrintModel *item = [weakSelf.datasource objectAtIndex:indexPath.row];
XPMineFootPrintModel *item = [weakSelf.datasource safeObjectAtIndex1:indexPath.row];
[weakSelf.presenter collectRoomWithRoomUid:item.roomUid];
completionHandler(true);
}];

View File

@@ -11,6 +11,7 @@
#import <MJRefresh/MJRefresh.h>
///Tool
#import "ThemeColor.h"
#import "NSArray+Safe.h"
///Model
#import "XPMineVisitorItemModel.h"
///View
@@ -130,7 +131,7 @@
cell.isFirstItem = indexPath.row == 0;
cell.isLastItem = indexPath.row == self.datasource.count - 1;
cell.delegate = self;
cell.item = [self.datasource objectAtIndex:indexPath.row];
cell.item = [self.datasource safeObjectAtIndex1:indexPath.row];
return cell;
}
@@ -153,7 +154,7 @@
#pragma mark - TTVisitorRecordCellDelegate
- (void)onAvatarClick:(XPMineVisitorTableViewCell *)cell {
NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
XPMineVisitorItemModel *item = [self.datasource objectAtIndex:indexPath.row];
XPMineVisitorItemModel *item = [self.datasource safeObjectAtIndex1:indexPath.row];
XPMineUserInfoViewController * userInfoVC = [[XPMineUserInfoViewController alloc] init];
userInfoVC.uid = item.uid;
[self.navigationController pushViewController:userInfoVC animated:YES];
@@ -161,7 +162,7 @@
- (void)onChatClick:(XPMineVisitorTableViewCell *)cell {
NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
XPMineVisitorItemModel *item = [self.datasource objectAtIndex:indexPath.row];
XPMineVisitorItemModel *item = [self.datasource safeObjectAtIndex1:indexPath.row];
NSString * sessionId = [NSString stringWithFormat:@"%lld",item.uid];
NIMSession * session = [NIMSession session:sessionId type:NIMSessionTypeP2P];
SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:session];

View File

@@ -11,6 +11,7 @@
#import <AVFoundation/AVFoundation.h>
#import "XPMacro.h"
#import "ThemeColor.h"
#import "NSArray+Safe.h"
@interface XPPermissionCell : UITableViewCell
@@ -194,9 +195,9 @@
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSInteger section = indexPath.section;
XPPermissionCell * cell = [[XPPermissionCell alloc] init];
cell.icon.image = [UIImage imageNamed:[self.permissionIcons objectAtIndex:section]];
cell.name.text = [self.permissionNames objectAtIndex:section];
cell.tip.text = [self.permissionTips objectAtIndex:section];
cell.icon.image = [UIImage imageNamed:[self.permissionIcons safeObjectAtIndex1:section]];
cell.name.text = [self.permissionNames safeObjectAtIndex1:section];
cell.tip.text = [self.permissionTips safeObjectAtIndex1:section];
return cell;
}

View File

@@ -12,6 +12,7 @@
#import "XPWebViewController.h"
#import "XPPermissionsViewController.h"
#import "XPHtmlUrl.h"
#import "NSArray+Safe.h"
@interface XPPrivacyViewController ()<UITableViewDelegate, UITableViewDataSource>
@@ -54,7 +55,7 @@
cell = [[XPMineSettingTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineSettingTableViewCell class])];
}
cell.itemModel = [self.datasource objectAtIndex:indexPath.row];
cell.itemModel = [self.datasource safeObjectAtIndex1:indexPath.row];
return cell;
}