Possibly fixing some freezes and crashes

This commit is contained in:
Jay 2020-04-09 23:29:26 -04:00
parent 1aebd3aced
commit d3579706d3
2 changed files with 3 additions and 2 deletions

View file

@ -347,7 +347,7 @@ class MangaDetailsPresenter(
* @param chapters the list of chapters to download. * @param chapters the list of chapters to download.
*/ */
fun downloadChapters(chapters: List<ChapterItem>) { fun downloadChapters(chapters: List<ChapterItem>) {
downloadManager.downloadChapters(manga, chapters) downloadManager.downloadChapters(manga, chapters.filter { !it.isDownloaded })
} }
fun restartDownloads() { fun restartDownloads() {

View file

@ -55,8 +55,9 @@ object ImageUtil {
return null return null
} }
fun autoSetBackground(image: Bitmap, useWhiteAlways: Boolean): Drawable { fun autoSetBackground(image: Bitmap?, useWhiteAlways: Boolean): Drawable {
val backgroundColor = if (useWhiteAlways) Color.WHITE else android.R.attr.colorBackground val backgroundColor = if (useWhiteAlways) Color.WHITE else android.R.attr.colorBackground
if (image == null) return ColorDrawable(backgroundColor)
if (image.width < 50 || image.height < 50) if (image.width < 50 || image.height < 50)
return ColorDrawable(backgroundColor) return ColorDrawable(backgroundColor)
val top = 5 val top = 5