Fix attempts to load images with null slug

This commit is contained in:
Kirill Kamakin
2021-11-14 19:08:05 +03:00
parent 99c5d24a98
commit e2050f3f28

View File

@@ -14,7 +14,7 @@ class RecipeImageLoaderImpl @Inject constructor(
override suspend fun loadRecipeImage(view: ImageView, slug: String?) {
val baseUrl = authRepo.getBaseUrl()
val recipeImageUrl =
if (baseUrl.isNullOrBlank()) null
if (baseUrl.isNullOrBlank() || slug.isNullOrBlank()) null
else "$baseUrl/api/media/recipes/$slug/images/original.webp"
imageLoader.loadImage(recipeImageUrl, R.drawable.placeholder_recipe, view)
}