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

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];
}