Random potential crash fixes

This commit is contained in:
Jays2Kings 2021-04-27 02:29:09 -04:00
parent dbf96f68ff
commit c9e22d898d
2 changed files with 2 additions and 2 deletions

View File

@ -73,7 +73,7 @@ class CategoryPresenter(
val cat = Category.create(name)
// 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.
cat.mangaSort = LibrarySort.Title.categoryValue

View File

@ -72,7 +72,7 @@ class LibraryCategoryAdapter(val controller: LibraryController) :
fun findCategoryHeader(catId: Int): LibraryHeaderItem? {
return currentItems.find {
(it is LibraryHeaderItem) && it.category.id == catId
} as LibraryHeaderItem
} as? LibraryHeaderItem
}
/**