mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 21:59:15 +01:00
Avoid migration failing if previous source doesn't exist
This commit is contained in:
parent
e3f3686b8a
commit
89dbb4d300
@ -30,7 +30,7 @@ interface EnhancedTrackService {
|
||||
/**
|
||||
* Checks whether the provided source/track/manga triplet is from this TrackService
|
||||
*/
|
||||
fun isTrackFrom(track: Track, manga: Manga, source: Source): Boolean
|
||||
fun isTrackFrom(track: Track, manga: Manga, source: Source?): Boolean
|
||||
|
||||
/**
|
||||
* Migrates the given track for the manga to the newSource, if possible
|
||||
|
@ -105,8 +105,8 @@ class Komga(private val context: Context, id: Int) : TrackService(id), EnhancedT
|
||||
null
|
||||
}
|
||||
|
||||
override fun isTrackFrom(track: Track, manga: Manga, source: Source): Boolean =
|
||||
accept(source) && track.tracking_url == manga.url
|
||||
override fun isTrackFrom(track: Track, manga: Manga, source: Source?): Boolean =
|
||||
track.tracking_url == manga.url && source?.let { accept(it) } == true
|
||||
|
||||
override fun migrateTrack(track: Track, manga: Manga, newSource: Source): Track? =
|
||||
if (accept(newSource)) {
|
||||
|
@ -63,8 +63,8 @@ class SearchPresenter(
|
||||
}
|
||||
|
||||
fun migrateManga(prevManga: Manga, manga: Manga, replace: Boolean) {
|
||||
val prevSource = sourceManager.get(prevManga.source) ?: return
|
||||
val source = sourceManager.get(manga.source) ?: return
|
||||
val prevSource = sourceManager.get(prevManga.source)
|
||||
|
||||
replacingMangaRelay.call(Pair(true, null))
|
||||
|
||||
@ -83,7 +83,7 @@ class SearchPresenter(
|
||||
}
|
||||
|
||||
private fun migrateMangaInternal(
|
||||
prevSource: Source,
|
||||
prevSource: Source?,
|
||||
source: Source,
|
||||
sourceChapters: List<SChapter>,
|
||||
prevManga: Manga,
|
||||
|
Loading…
Reference in New Issue
Block a user