1
Fork 0
mirror of https://github.com/Steffo99/twom.git synced 2024-11-21 23:54:26 +00:00

Fix empty avatars getting replaced with something different

This commit is contained in:
Steffo 2023-12-07 03:37:48 +01:00
parent 2ce3f4745d
commit 61d9921693
Signed by: steffo
GPG key ID: 2A24051445686895

View file

@ -28,14 +28,17 @@ fun AvatarFromURL(
LaunchedEffect(session, url) GetAvatar@{
if (session == null) {
Log.d("Avatar", "Not doing anything, session is null.")
bitmap = null
return@GetAvatar
}
if (url == null) {
Log.d("Avatar", "URL is null, not downloading anything.")
bitmap = null
return@GetAvatar
}
if (url.isEmpty()) {
Log.d("Avatar", "URL is a zero-length string, not downloading anything.")
bitmap = null
return@GetAvatar
}
Log.d("Avatar", "Downloading avatar at: $url")
@ -50,7 +53,7 @@ fun AvatarFromURL(
bitmap = BitmapFactory.decodeFile(avatarFile.absolutePath)
}
if (session == null || url == null || bitmap == null) {
if (bitmap == null) {
AvatarFromDefault(
modifier = modifier,
fallbackText = fallbackText,