diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt index bed8c5e36..e6c7e7ba9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt @@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.data.download import android.content.Context import android.net.Uri import com.hippo.unifile.UniFile +import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.Chapter import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.preference.PreferencesHelper @@ -46,9 +47,13 @@ class DownloadProvider(private val context: Context) { * @param source the source of the manga. */ internal fun getMangaDir(manga: Manga, source: Source): UniFile { - return downloadsDir - .createDirectory(getSourceDirName(source)) - .createDirectory(getMangaDirName(manga)) + try { + return downloadsDir + .createDirectory(getSourceDirName(source)) + .createDirectory(getMangaDirName(manga)) + } catch (e: NullPointerException) { + throw Exception(context.getString(R.string.invalid_download_dir)) + } } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt index 0dc8e1e6c..1388101c4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt @@ -102,7 +102,7 @@ class Downloader( pending.forEach { if (it.status != Download.QUEUE) it.status = Download.QUEUE } downloadsRelay.call(pending) - return !pending.isEmpty() + return pending.isNotEmpty() } /** diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1502040f3..9373e4aff 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -393,6 +393,7 @@ Download all Download unread Are you sure you want to delete selected chapters? + Invalid download directory Tracking