@@ -84,7 +84,9 @@ enum AssetUtil {
84
84
key. perform ( Selector ( ( " keyList " ) ) ) ,
85
85
to: UnsafeMutableRawPointer . self
86
86
)
87
- let rendition = createRendition ( from: structuredThemeStore, keyList)
87
+ guard let rendition = createRendition ( from: structuredThemeStore, keyList) else {
88
+ continue
89
+ }
88
90
89
91
let data = rendition. value ( forKey: " _srcData " ) as! Data
90
92
let length = UInt ( data. count)
@@ -198,13 +200,13 @@ enum AssetUtil {
198
200
}
199
201
200
202
private static func createRendition( from themeStore: NSObject , _ keyList: UnsafeMutableRawPointer )
201
- -> NSObject
203
+ -> NSObject ?
202
204
{
203
205
let renditionWithKeySelector = Selector ( ( " renditionWithKey: " ) )
204
206
let renditionWithKeyMethod = themeStore. method ( for: renditionWithKeySelector) !
205
207
let renditionWithKeyImp = unsafeBitCast ( renditionWithKeyMethod, to: objectiveCMethodImp. self)
206
- return renditionWithKeyImp ( themeStore, renditionWithKeySelector, keyList) ! . takeUnretainedValue ( )
207
- as! NSObject
208
+ return renditionWithKeyImp ( themeStore, renditionWithKeySelector, keyList) ? . takeUnretainedValue ( )
209
+ as? NSObject
208
210
}
209
211
210
212
private static func handleReferenceKey(
@@ -222,7 +224,9 @@ enum AssetUtil {
222
224
referenceKey. perform ( Selector ( ( " keyList " ) ) ) ,
223
225
to: UnsafeMutableRawPointer . self
224
226
)
225
- let referenceRendition = createRendition ( from: themeStore, referenceKeyList)
227
+ guard let referenceRendition = createRendition ( from: themeStore, referenceKeyList) else {
228
+ return false
229
+ }
226
230
227
231
if let result = referenceRendition. perform ( Selector ( ( " unslicedImage " ) ) ) {
228
232
let image = result. takeUnretainedValue ( ) as! CGImage
0 commit comments