mirror of
https://github.com/mamoe/mirai.git
synced 2025-04-25 13:03:35 +08:00
Fix AbsoluteFolder.resolveFileById for recursive (#2033)
```kotlin @Test fun testFirst() { val f = { a: Int -> if (a > 0) a else null } val a = listOf<Int>(-1, -2, -1, -1) assertEquals( a.map{ f(it) }.firstOrNull(), null ) } ```
This commit is contained in:
parent
c6b47a3231
commit
bc8fea2195
@ -389,7 +389,7 @@ internal class AbsoluteFolderImpl(
|
||||
|
||||
if (!deep) return null
|
||||
|
||||
return folders().map { it.resolveFileById(id, deep) }.firstOrNull()
|
||||
return folders().map { it.resolveFileById(id, deep) }.firstOrNull{ it != null }
|
||||
}
|
||||
|
||||
override suspend fun resolveFiles(path: String): Flow<AbsoluteFile> {
|
||||
@ -495,4 +495,4 @@ internal class AbsoluteFolderImpl(
|
||||
result = 31 * result + contentsCount.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user