home: fix crash on music updates

This commit is contained in:
Alexander Capehart
2024-02-28 23:00:20 -07:00
parent 399e181e39
commit b43586c1ea
6 changed files with 6 additions and 5 deletions
+1
View File
@@ -6,6 +6,7 @@
- Fixed "Add to queue" incorrectly changing the queue and crashing the app
- Fixed 1x4 and 1x3 widgets having square edges
- Fixed crash when music library updates in such a way to change music information
- Fixed crash when music library updates while scrolled in a list
## 3.4.1
@@ -95,7 +95,7 @@ class AlbumListFragment :
}
override fun getPopup(pos: Int): String? {
val album = homeModel.albumList.value[pos]
val album = homeModel.albumList.value.getOrNull(pos) ?: return null
// Change how we display the popup depending on the current sort mode.
return when (homeModel.albumSort.mode) {
// By Name -> Use Name
@@ -90,7 +90,7 @@ class ArtistListFragment :
}
override fun getPopup(pos: Int): String? {
val artist = homeModel.artistList.value[pos]
val artist = homeModel.artistList.value.getOrNull(pos) ?: return null
// Change how we display the popup depending on the current sort mode.
return when (homeModel.artistSort.mode) {
// By Name -> Use Name
@@ -89,7 +89,7 @@ class GenreListFragment :
}
override fun getPopup(pos: Int): String? {
val genre = homeModel.genreList.value[pos]
val genre = homeModel.genreList.value.getOrNull(pos) ?: return null
// Change how we display the popup depending on the current sort mode.
return when (homeModel.genreSort.mode) {
// By Name -> Use Name
@@ -87,7 +87,7 @@ class PlaylistListFragment :
}
override fun getPopup(pos: Int): String? {
val playlist = homeModel.playlistList.value[pos]
val playlist = homeModel.playlistList.value.getOrNull(pos) ?: return null
// Change how we display the popup depending on the current sort mode.
return when (homeModel.playlistSort.mode) {
// By Name -> Use Name
@@ -92,7 +92,7 @@ class SongListFragment :
}
override fun getPopup(pos: Int): String? {
val song = homeModel.songList.value[pos]
val song = homeModel.songList.value.getOrNull(pos) ?: return null
// Change how we display the popup depending on the current sort mode.
// Note: We don't use the more correct individual artist name here, as sorts are largely
// based off the names of the parent objects and not the child objects.