Few more tracepot crashes

This commit is contained in:
Jay 2020-05-11 12:55:53 -04:00
parent 3ad9d84b5f
commit fdd4b08a49
3 changed files with 4 additions and 3 deletions

View File

@ -6,8 +6,6 @@ class LibraryManga : MangaImpl() {
var category: Int = 0 var category: Int = 0
fun isBlank() = id == Long.MIN_VALUE
companion object { companion object {
fun createBlank(categoryId: Int): LibraryManga = LibraryManga().apply { fun createBlank(categoryId: Int): LibraryManga = LibraryManga().apply {
title = "" title = ""

View File

@ -27,6 +27,8 @@ interface Manga : SManga {
var hide_title: Boolean var hide_title: Boolean
fun isBlank() = id == Long.MIN_VALUE
fun setChapterOrder(order: Int) { fun setChapterOrder(order: Int) {
setFlags(order, SORT_MASK) setFlags(order, SORT_MASK)
setFlags(SORT_LOCAL, SORT_SELF_MASK) setFlags(SORT_LOCAL, SORT_SELF_MASK)

View File

@ -289,7 +289,7 @@ class LibraryController(
if (libraryLayout == 0) return 1 if (libraryLayout == 0) return 1
val item = this@LibraryController.adapter.getItem(position) val item = this@LibraryController.adapter.getItem(position)
return if (item is LibraryHeaderItem || item is SearchGlobalItem || (item is LibraryItem && item.manga.isBlank())) { return if (item is LibraryHeaderItem || item is SearchGlobalItem || (item is LibraryItem && item.manga.isBlank())) {
recycler.manager.spanCount recycler?.manager?.spanCount ?: 1
} else { } else {
1 1
} }
@ -829,6 +829,7 @@ class LibraryController(
} }
private fun setSelection(manga: Manga, selected: Boolean) { private fun setSelection(manga: Manga, selected: Boolean) {
if (manga.isBlank()) return
val currentMode = adapter.mode val currentMode = adapter.mode
if (selected) { if (selected) {
if (selectedMangas.add(manga)) { if (selectedMangas.add(manga)) {