mac/menu: properly guard playlist array access

This commit is contained in:
der richter 2024-03-03 22:53:00 +01:00
parent 30eab4b933
commit 46a9e8c130
1 changed files with 2 additions and 2 deletions

View File

@ -342,8 +342,8 @@ class MenuBar: NSObject {
@objc func openPlaylist() {
let panel = NSOpenPanel()
if panel.runModal() == .OK {
"loadlist \"\(panel.urls[0].path)\"".withCString {
if panel.runModal() == .OK, let url = panel.urls.first {
"loadlist \"\(url.path)\"".withCString {
EventsResponder.sharedInstance().queueCommand(UnsafeMutablePointer<CChar>(mutating: $0))
}
}