fix: Don't assume download dir is not null

This commit is contained in:
Ahmad Ansori Palembani 2024-05-27 18:49:26 +07:00
parent c7076102c9
commit 7daa7cb7c9
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6

View file

@ -126,7 +126,7 @@ class DownloadCache(
private fun renew() {
val onlineSources = sourceManager.getOnlineSources()
val sourceDirs = storageManager.getDownloadsDirectory()!!.listFiles().orEmpty()
val sourceDirs = storageManager.getDownloadsDirectory()?.listFiles().orEmpty()
.associate { it.name to SourceDirectory(it) }.mapNotNullKeys { entry ->
onlineSources.find { provider.getSourceDirName(it).equals(entry.key, ignoreCase = true) }?.id
}