From 18939041359c81efc5751fda041427909892b3ee Mon Sep 17 00:00:00 2001 From: Amine Date: Sun, 19 Jan 2025 14:48:29 +0100 Subject: [PATCH] fix: Handle empty url issue. --- .../apps/readerforselfossv2/android/utils/glide/GlideUtils.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/utils/glide/GlideUtils.kt b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/utils/glide/GlideUtils.kt index 10b4954..b9d179e 100644 --- a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/utils/glide/GlideUtils.kt +++ b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/utils/glide/GlideUtils.kt @@ -7,6 +7,7 @@ import android.webkit.WebView import android.widget.ImageView import bou.amine.apps.readerforselfossv2.android.utils.CircleImageView import bou.amine.apps.readerforselfossv2.service.AppSettingsService +import bou.amine.apps.readerforselfossv2.utils.isEmptyOrNullOrNullString import com.bumptech.glide.Glide import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.model.GlideUrl @@ -24,6 +25,9 @@ private const val PRELOAD_IMAGE_TIMEOUT = 10000 @OptIn(ExperimentalEncodingApi::class) fun String.toGlideUrl(appSettingsService: AppSettingsService): GlideUrl { + if (this.isEmptyOrNullOrNullString()) { + return GlideUrl("") + } if (appSettingsService.getBasicUserName().isNotEmpty()) { val authString = "${appSettingsService.getBasicUserName()}:${appSettingsService.getBasicPassword()}" val authBuf = Base64.encode(authString.toByteArray(Charsets.UTF_8))