Avoid migration failing if previous source doesn't exist

This commit is contained in:
arkon
2022-01-23 17:21:23 -05:00
parent e3f3686b8a
commit 89dbb4d300
3 changed files with 5 additions and 5 deletions

View File

@@ -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

View File

@@ -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)) {