修复了数组可能越界的问题
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#import "XPMacro.h"
|
||||
#import "XPMonentsLayoutConfig.h"
|
||||
#import "TTPopup.h"
|
||||
#import "NSArray+Safe.h"
|
||||
///Model
|
||||
#import "MonentsListInfoModel.h"
|
||||
///P
|
||||
@@ -101,7 +102,7 @@
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (self.datasource.count > 0) {
|
||||
MonentsInfoModel * monentInfo= [self.datasource objectAtIndex:indexPath.row];
|
||||
MonentsInfoModel * monentInfo= [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
[XPMonentsLayoutConfig layoutMonentsModel:monentInfo];
|
||||
return monentInfo.rowHeight;
|
||||
}
|
||||
@@ -111,7 +112,7 @@
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (self.datasource.count > 0) {
|
||||
XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
|
||||
MonentsInfoModel * monentsInfo = [self.datasource objectAtIndex:indexPath.row];
|
||||
MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
cell.delegate = self;
|
||||
cell.monentsInfo = monentsInfo;
|
||||
return cell;
|
||||
@@ -124,7 +125,7 @@
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
if (self.datasource.count > 0) {
|
||||
XPMonentsDetailViewController * detailVC = [[XPMonentsDetailViewController alloc] init];
|
||||
MonentsInfoModel * monentsInfo = [self.datasource objectAtIndex:indexPath.row];
|
||||
MonentsInfoModel * monentsInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
detailVC.monentsInfo = monentsInfo;
|
||||
detailVC.delegate = self;
|
||||
[self.navigationController pushViewController:detailVC animated:YES];
|
||||
|
Reference in New Issue
Block a user