mirror of
https://github.com/Suwayomi/Tachidesk.git
synced 2025-12-21 12:02:35 +01:00
Fix sources list of one source throws an exception (#308)
This commit is contained in:
@@ -24,6 +24,7 @@ import suwayomi.tachidesk.manga.impl.extension.Extension.getExtensionIconUrl
|
|||||||
import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource.getCatalogueSource
|
import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource.getCatalogueSource
|
||||||
import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource.getCatalogueSourceOrStub
|
import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource.getCatalogueSourceOrStub
|
||||||
import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource.unregisterCatalogueSource
|
import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource.unregisterCatalogueSource
|
||||||
|
import suwayomi.tachidesk.manga.impl.util.source.StubSource
|
||||||
import suwayomi.tachidesk.manga.model.dataclass.SourceDataClass
|
import suwayomi.tachidesk.manga.model.dataclass.SourceDataClass
|
||||||
import suwayomi.tachidesk.manga.model.table.ExtensionTable
|
import suwayomi.tachidesk.manga.model.table.ExtensionTable
|
||||||
import suwayomi.tachidesk.manga.model.table.SourceTable
|
import suwayomi.tachidesk.manga.model.table.SourceTable
|
||||||
@@ -36,8 +37,9 @@ object Source {
|
|||||||
|
|
||||||
fun getSourceList(): List<SourceDataClass> {
|
fun getSourceList(): List<SourceDataClass> {
|
||||||
return transaction {
|
return transaction {
|
||||||
SourceTable.selectAll().map {
|
SourceTable.selectAll().mapNotNull {
|
||||||
val catalogueSource = getCatalogueSourceOrStub(it[SourceTable.id].value)
|
val catalogueSource = getCatalogueSourceOrStub(it[SourceTable.id].value)
|
||||||
|
if (catalogueSource is StubSource) return@mapNotNull null
|
||||||
val sourceExtension = ExtensionTable.select { ExtensionTable.id eq it[SourceTable.extension] }.first()
|
val sourceExtension = ExtensionTable.select { ExtensionTable.id eq it[SourceTable.extension] }.first()
|
||||||
|
|
||||||
SourceDataClass(
|
SourceDataClass(
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ object GetCatalogueSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getCatalogueSourceOrStub(sourceId: Long): CatalogueSource {
|
fun getCatalogueSourceOrStub(sourceId: Long): CatalogueSource {
|
||||||
return getCatalogueSource(sourceId) ?: StubSource(sourceId)
|
return runCatching { getCatalogueSource(sourceId) }.getOrNull() ?: StubSource(sourceId)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun registerCatalogueSource(sourcePair: Pair<Long, CatalogueSource>) {
|
fun registerCatalogueSource(sourcePair: Pair<Long, CatalogueSource>) {
|
||||||
|
|||||||
Reference in New Issue
Block a user