Fix use of optionals

This commit is contained in:
ronaldheft 2022-07-09 15:18:59 -04:00
parent f40da562a6
commit 29f08a5e5d

View file

@ -28,10 +28,11 @@ public class AbsDownloader: CAPPlugin {
}
}
}
func startLibraryItemDownload(libraryItem: LibraryItem) {
let length = libraryItem.media.tracks.count
let length = libraryItem.media.tracks?.count ?? 0
if length > 0 {
libraryItem.media.tracks.enumerated().forEach { position, track in
libraryItem.media.tracks?.enumerated().forEach { position, track in
NSLog("TRACK \(track.contentUrl!)")
// filename needs to be encoded otherwise would just use contentUrl
let filename = track.metadata?.filename ?? ""