mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
Attempt to fix album detail view crash
Very occasionally the album detail view fails to get the album tracks and this causes a crash. This extra guard avoids the crash, but doesn't fix the underlying problem. The problem itself is very hard to track down because it's incredibly hard to reproduce.
This commit is contained in:
parent
eb5cee2a75
commit
a7e7620f68
@ -113,15 +113,18 @@ class AlbumDetailView: NSViewController {
|
||||
}
|
||||
|
||||
func getAlbumSongs(for album: Album) {
|
||||
App.mpdClient.getAlbumSongs(for: album.mpdAlbum) { [self] (mpdSongs: [MPDClient.MPDSong]) in
|
||||
self.dataSource.setAlbumSongs(
|
||||
mpdSongs.map { Song(mpdSong: $0) }
|
||||
)
|
||||
App.mpdClient.getAlbumSongs(for: album.mpdAlbum) { [weak self] (mpdSongs: [MPDClient.MPDSong]) in
|
||||
guard let self = self else { return }
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.dataSource.setAlbumSongs(
|
||||
mpdSongs.map { Song(mpdSong: $0) }
|
||||
)
|
||||
|
||||
self.albumTracksView.reloadData()
|
||||
|
||||
guard let song = self.dataSource.albumSongs.first?.song ??
|
||||
guard !self.dataSource.albumSongs.isEmpty,
|
||||
let song = self.dataSource.albumSongs.first?.song ??
|
||||
self.dataSource.albumSongs[1].song
|
||||
else { return }
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user