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
448165d786
commit
87259920e8
@ -113,15 +113,18 @@ class AlbumDetailView: NSViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getAlbumSongs(for album: Album) {
|
func getAlbumSongs(for album: Album) {
|
||||||
App.mpdClient.getAlbumSongs(for: album.mpdAlbum) { [self] (mpdSongs: [MPDClient.MPDSong]) in
|
App.mpdClient.getAlbumSongs(for: album.mpdAlbum) { [weak self] (mpdSongs: [MPDClient.MPDSong]) in
|
||||||
self.dataSource.setAlbumSongs(
|
guard let self = self else { return }
|
||||||
mpdSongs.map { Song(mpdSong: $0) }
|
|
||||||
)
|
|
||||||
|
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
|
self.dataSource.setAlbumSongs(
|
||||||
|
mpdSongs.map { Song(mpdSong: $0) }
|
||||||
|
)
|
||||||
|
|
||||||
self.albumTracksView.reloadData()
|
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
|
self.dataSource.albumSongs[1].song
|
||||||
else { return }
|
else { return }
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user