mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 11:31:54 +01:00
Random potential crash fixes
This commit is contained in:
parent
dbf96f68ff
commit
c9e22d898d
@ -73,7 +73,7 @@ class CategoryPresenter(
|
|||||||
val cat = Category.create(name)
|
val cat = Category.create(name)
|
||||||
|
|
||||||
// Set the new item in the last position.
|
// Set the new item in the last position.
|
||||||
cat.order = categories.maxOf { it.order } + 1
|
cat.order = (categories.maxOfOrNull { it.order } ?: 0) + 1
|
||||||
|
|
||||||
// Insert into database.
|
// Insert into database.
|
||||||
cat.mangaSort = LibrarySort.Title.categoryValue
|
cat.mangaSort = LibrarySort.Title.categoryValue
|
||||||
|
@ -72,7 +72,7 @@ class LibraryCategoryAdapter(val controller: LibraryController) :
|
|||||||
fun findCategoryHeader(catId: Int): LibraryHeaderItem? {
|
fun findCategoryHeader(catId: Int): LibraryHeaderItem? {
|
||||||
return currentItems.find {
|
return currentItems.find {
|
||||||
(it is LibraryHeaderItem) && it.category.id == catId
|
(it is LibraryHeaderItem) && it.category.id == catId
|
||||||
} as LibraryHeaderItem
|
} as? LibraryHeaderItem
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user