Fixed rare crash when rotating screen in library

This commit is contained in:
Jay 2020-04-23 03:24:01 -04:00
parent e2410fafb8
commit 950452579f

View File

@ -1,5 +1,6 @@
package eu.kanade.tachiyomi.ui.library package eu.kanade.tachiyomi.ui.library
import android.app.Activity
import android.view.Gravity import android.view.Gravity
import android.view.View import android.view.View
import android.widget.FrameLayout import android.widget.FrameLayout
@ -78,6 +79,7 @@ class LibraryGridHolder(
} }
private fun setCover(manga: Manga, id: Long) { private fun setCover(manga: Manga, id: Long) {
if ((adapter.recyclerView.context as? Activity)?.isDestroyed == true) return
GlideApp.with(adapter.recyclerView.context).load(manga) GlideApp.with(adapter.recyclerView.context).load(manga)
.diskCacheStrategy(DiskCacheStrategy.AUTOMATIC) .diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
.signature(ObjectKey(MangaImpl.getLastCoverFetch(id).toString())) .signature(ObjectKey(MangaImpl.getLastCoverFetch(id).toString()))