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

This commit is contained in:
fengshuo
2022-11-11 17:46:37 +08:00
parent e855f87849
commit c22ede0a13
146 changed files with 515 additions and 371 deletions

View File

@@ -13,6 +13,7 @@
#import "ThemeColor.h"
#import "TTPopup.h"
#import "XPMacro.h"
#import "NSArray+Safe.h"
///Model
#import "MonentsInteractiveModel.h"
///P
@@ -105,7 +106,7 @@
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.datasource.count > 0) {
MonentsInteractiveModel * model = [self.datasource objectAtIndex:indexPath.row];
MonentsInteractiveModel * model = [self.datasource safeObjectAtIndex1:indexPath.row];
return model.worldName.length > 0? 130 : 90;
}
return KScreenHeight - kNavigationHeight;
@@ -114,7 +115,7 @@
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.datasource.count > 0) {
XPMonentsInteractiveTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsInteractiveTableViewCell class])];
MonentsInteractiveModel * model = [self.datasource objectAtIndex:indexPath.row];
MonentsInteractiveModel * model = [self.datasource safeObjectAtIndex1:indexPath.row];
cell.interactiveInfo = model;
return cell;
}
@@ -126,7 +127,7 @@
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if (self.datasource.count > 0) {
XPMonentsDetailViewController * detailVC = [[XPMonentsDetailViewController alloc] init];
MonentsInteractiveModel * model = [self.datasource objectAtIndex:indexPath.row];
MonentsInteractiveModel * model = [self.datasource safeObjectAtIndex1:indexPath.row];
MonentsInfoModel * monents = [[MonentsInfoModel alloc] init];
monents.dynamicId = model.dynamicId;
detailVC.monentsInfo = monents;