0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-19 19:42:17 +02:00

chore: guard against null getExternalFilesDirs

I know `getExternalFilesDir(null)!!` can throw, I'm unsure
if the array can throw, but it's best to be safe here
This commit is contained in:
David Allison 2024-03-05 20:01:32 +00:00 committed by Mike Hardy
parent 9175d9ec29
commit 0d46ac3523

View File

@ -230,7 +230,7 @@ object CollectionHelper {
* @see android.content.Context.getExternalFilesDirs
*/
fun getAppSpecificExternalDirectories(context: Context): List<File> {
return context.getExternalFilesDirs(null).filterNotNull()
return context.getExternalFilesDirs(null)?.filterNotNull() ?: listOf()
}
/**