修复了数组可能越界的问题
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#import "NetImageView.h"
|
||||
#import "ThemeColor.h"
|
||||
#import "UIImage+Utils.h"
|
||||
#import "NSArray+Safe.h"
|
||||
///Model
|
||||
#import "UserInfoModel.h"
|
||||
#import "XPGiftUserInfoModel.h"
|
||||
@@ -127,7 +128,7 @@
|
||||
}];
|
||||
|
||||
for (int i = 0; i < newArray.count; i++) {
|
||||
XPGiftUserInfoModel * userInfo = [newArray objectAtIndex:i];
|
||||
XPGiftUserInfoModel * userInfo = [newArray safeObjectAtIndex1:i];
|
||||
if (userInfo && userInfo.uid > 0 && userInfo.uid != uid.integerValue) { ///自己在麦上不显示在送礼物列表中
|
||||
NSString * uid = [NSString stringWithFormat:@"%ld", userInfo.uid];
|
||||
if (userInfo.isSelect) {
|
||||
@@ -162,14 +163,14 @@
|
||||
|
||||
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
XPGiftUserCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPGiftUserCollectionViewCell class]) forIndexPath:indexPath];
|
||||
XPGiftUserInfoModel * queue = [self.userArray objectAtIndex:indexPath.row];
|
||||
XPGiftUserInfoModel * queue = [self.userArray safeObjectAtIndex1:indexPath.row];
|
||||
cell.userInfo = queue;
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[collectionView deselectItemAtIndexPath:indexPath animated:YES];
|
||||
XPGiftUserInfoModel * queue = [self.userArray objectAtIndex:indexPath.row];
|
||||
XPGiftUserInfoModel * queue = [self.userArray safeObjectAtIndex1:indexPath.row];
|
||||
queue.isSelect = !queue.isSelect;
|
||||
[self.collectionView reloadData];
|
||||
NSString * selectUid = [NSString stringWithFormat:@"%ld", queue.uid];
|
||||
|
Reference in New Issue
Block a user