Skip to content

Commit

Permalink
Merge pull request #1123 from TortugaPower/fix-crash-launch
Browse files Browse the repository at this point in the history
Fix crash on launch due to memory usage spike
  • Loading branch information
GianniCarlo authored Mar 30, 2024
2 parents 7171bfc + 6ee67f0 commit 5ba6f9c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Shared/Artwork/AVAudioAssetImageDataProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@ public struct AVAudioAssetImageDataProvider: ImageDataProvider {
private func handleDirectory(at url: URL, handler: @escaping (Result<Data, Error>) -> Void) {
/// Process any image file from within the folder
if let contents = try? FileManager.default.contentsOfDirectory(at: url, includingPropertiesForKeys: nil),
let imageURL = contents.first(where: {
UTType(filenameExtension: $0.pathExtension, conformingTo: .image) != nil
let imageURL = contents.first(where: { file in
let type = UTType(filenameExtension: file.pathExtension)
return type?.isSubtype(of: .image) == true
}),
let imageData = try? Data(contentsOf: imageURL) {
handler(.success(imageData))
Expand Down

0 comments on commit 5ba6f9c

Please sign in to comment.