Fix crash when deleting last item in library (#6079)
This commit is contained in:
parent
aae011ed83
commit
3448751e0e
1 changed files with 3 additions and 3 deletions
|
@ -139,9 +139,9 @@ class LibraryAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getViewType(position: Int): Int {
|
override fun getViewType(position: Int): Int {
|
||||||
val category = categories[position]
|
val category = categories.getOrNull(position)
|
||||||
return if (isPerCategory && category.id != 0) {
|
return if (isPerCategory && category?.id != 0) {
|
||||||
if (DisplayModeSetting.fromFlag(category.displayMode) == DisplayModeSetting.LIST) {
|
if (DisplayModeSetting.fromFlag(category?.displayMode) == DisplayModeSetting.LIST) {
|
||||||
LIST_DISPLAY_MODE
|
LIST_DISPLAY_MODE
|
||||||
} else {
|
} else {
|
||||||
GRID_DISPLAY_MODE
|
GRID_DISPLAY_MODE
|
||||||
|
|
Reference in a new issue