diff --git a/Sources/Controller/ImagePickerController.swift b/Sources/Controller/ImagePickerController.swift index 85b086de..d1e28790 100644 --- a/Sources/Controller/ImagePickerController.swift +++ b/Sources/Controller/ImagePickerController.swift @@ -64,7 +64,7 @@ import Photos let fetchOptions = settings.fetch.assets.options.copy() as! PHFetchOptions fetchOptions.fetchLimit = 1 - return settings.fetch.album.fetchResults.filter { + return settings.fetch.album.fetchResults().filter { $0.count > 0 }.flatMap { $0.objects(at: IndexSet(integersIn: 0..<$0.count)) diff --git a/Sources/Model/Settings.swift b/Sources/Model/Settings.swift index 5ff8b351..a1fcd2b5 100755 --- a/Sources/Model/Settings.swift +++ b/Sources/Model/Settings.swift @@ -119,9 +119,11 @@ import Photos /// PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .smartAlbumSelfPortraits, options: options), /// PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .smartAlbumPanoramas, options: options), /// PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .smartAlbumVideos, options: options), - public lazy var fetchResults: [PHFetchResult] = [ - PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .smartAlbumUserLibrary, options: options), - ] + public lazy var fetchResults: () -> [PHFetchResult] = { [options] in + return [ + PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .smartAlbumUserLibrary, options: options), + ] + } } @objc(BSImagePickerAssets)