From 14276f41d85a5a0a2be6d0df6e159a706bea2818 Mon Sep 17 00:00:00 2001 From: shenlong <139912620+shenlong-tanwen@users.noreply.github.com> Date: Wed, 2 Jul 2025 22:56:42 +0530 Subject: [PATCH] fix: handle null bucket name during android sync (#19685) Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> --- .../main/kotlin/app/alextran/immich/sync/MessagesImplBase.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mobile/android/app/src/main/kotlin/app/alextran/immich/sync/MessagesImplBase.kt b/mobile/android/app/src/main/kotlin/app/alextran/immich/sync/MessagesImplBase.kt index 9ec0d763f7..5183c274b3 100644 --- a/mobile/android/app/src/main/kotlin/app/alextran/immich/sync/MessagesImplBase.kt +++ b/mobile/android/app/src/main/kotlin/app/alextran/immich/sync/MessagesImplBase.kt @@ -5,6 +5,7 @@ import android.content.Context import android.database.Cursor import android.provider.MediaStore import android.util.Log +import androidx.core.database.getStringOrNull import java.io.File import java.io.FileInputStream import java.security.MessageDigest @@ -152,7 +153,8 @@ open class NativeSyncApiImplBase(context: Context) { continue } - val name = cursor.getString(bucketNameColumn) + // MediaStore might return null for bucket name (commonly for the Root Directory), so default to "Internal Storage" + val name = cursor.getStringOrNull(bucketNameColumn) ?: "Internal Storage" val updatedAt = cursor.getLong(dateModified) albums.add(PlatformAlbum(id, name, updatedAt, false, 0)) albumsCount[id] = 1