Skip to content

Commit

Permalink
config: fix display of custom icon
Browse files Browse the repository at this point in the history
Fixes #6137
  • Loading branch information
osy committed Mar 31, 2024
1 parent e26e8f2 commit 436d238
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Services/UTMExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,12 @@ extension CGColor {
extension UIImage {
convenience init?(contentsOfURL: URL?) {
if let url = contentsOfURL {
let scoped = url.startAccessingSecurityScopedResource()
defer {
if scoped {
url.stopAccessingSecurityScopedResource()
}
}
self.init(contentsOfFile: url.path)
} else {
return nil
Expand Down Expand Up @@ -295,6 +301,12 @@ extension View {
extension NSImage {
convenience init?(contentsOfURL: URL?) {
if let url = contentsOfURL {
let scoped = url.startAccessingSecurityScopedResource()
defer {
if scoped {
url.stopAccessingSecurityScopedResource()
}
}
self.init(contentsOf: url)
} else {
return nil
Expand Down

0 comments on commit 436d238

Please sign in to comment.