From a4741c2aec71d62ef226747f7c797b493a5e66ce Mon Sep 17 00:00:00 2001 From: questbeat Date: Tue, 14 Apr 2015 16:27:30 +0900 Subject: [PATCH] Fix crash if there is no asset in folder --- QBImagePicker/Info.plist | 2 +- QBImagePicker/QBAssetsViewController.m | 6 ++++-- QBImagePickerController.podspec | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/QBImagePicker/Info.plist b/QBImagePicker/Info.plist index 3d73e614..e8fa6ea2 100644 --- a/QBImagePicker/Info.plist +++ b/QBImagePicker/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 3.1.0 + 3.1.1 CFBundleSignature ???? CFBundleVersion diff --git a/QBImagePicker/QBAssetsViewController.m b/QBImagePicker/QBAssetsViewController.m index 6923071b..ae30eb7b 100644 --- a/QBImagePicker/QBAssetsViewController.m +++ b/QBImagePicker/QBAssetsViewController.m @@ -370,8 +370,10 @@ - (NSArray *)assetsAtIndexPaths:(NSArray *)indexPaths NSMutableArray *assets = [NSMutableArray arrayWithCapacity:indexPaths.count]; for (NSIndexPath *indexPath in indexPaths) { - PHAsset *asset = self.fetchResult[indexPath.item]; - [assets addObject:asset]; + if (indexPath.item < self.fetchResult.count) { + PHAsset *asset = self.fetchResult[indexPath.item]; + [assets addObject:asset]; + } } return assets; } diff --git a/QBImagePickerController.podspec b/QBImagePickerController.podspec index c2012504..c2745a60 100644 --- a/QBImagePickerController.podspec +++ b/QBImagePickerController.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "QBImagePickerController" - s.version = "3.1.0" + s.version = "3.1.1" s.summary = "A clone of UIImagePickerController with multiple selection support." s.homepage = "https://github.com/questbeat/QBImagePicker" s.license = "MIT"