diff --git a/app/src/main/java/io/legado/app/help/ImageLoader.kt b/app/src/main/java/io/legado/app/help/ImageLoader.kt index 26a9063d6..3d4272e9e 100644 --- a/app/src/main/java/io/legado/app/help/ImageLoader.kt +++ b/app/src/main/java/io/legado/app/help/ImageLoader.kt @@ -12,13 +12,15 @@ import java.io.File object ImageLoader { fun load(context: Context, path: String?): RequestBuilder { - if (path?.startsWith("http", true) == true) { - return Glide.with(context).load(path) + return when { + path.isNullOrEmpty() -> Glide.with(context).load(path) + path.startsWith("http", true) -> Glide.with(context).load(path) + else -> try { + Glide.with(context).load(File(path)) + } catch (e: Exception) { + Glide.with(context).load(path) + } } - kotlin.runCatching { - return Glide.with(context).load(File(path)) - } - return Glide.with(context).load(path) } fun load(context: Context, @DrawableRes resId: Int?): RequestBuilder {