music: fix selector error with malformed folders

Forgot that i is not a good indicator of if we need to begin a selector
or not since we may discard certain music folders.
This commit is contained in:
Alexander Capehart 2024-01-09 13:50:02 -07:00
parent 5d5356e46e
commit 6a0fd76636
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47

View file

@ -137,7 +137,7 @@ private constructor(private val cursor: Cursor, volumeManager: VolumeManager) :
val path = paths[i]
val volume = path.volume.components ?: continue
template +=
if (i == 0) {
if (args.isEmpty()) {
"${MediaStore.Audio.AudioColumns.DATA} LIKE ?"
} else {
" OR ${MediaStore.Audio.AudioColumns.DATA} LIKE ?"
@ -217,7 +217,7 @@ private constructor(private val cursor: Cursor, volumeManager: VolumeManager) :
for (i in paths.indices) {
val path = paths[i]
template =
if (i == 0) {
if (args.isEmpty()) {
"(${MediaStore.Audio.AudioColumns.VOLUME_NAME} LIKE ? " +
"AND ${MediaStore.Audio.AudioColumns.RELATIVE_PATH} LIKE ?)"
} else {