From 9773a481c88720ded15c41d3f12d77ef72392f2f Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 22 Jan 2017 18:53:32 +0100 Subject: [PATCH] add some null checks to obtaining directories --- .../simplemobiletools/gallery/extensions/context.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt index f110d95a5..397bb80ee 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -54,7 +54,7 @@ fun Context.getParents(isPickImage: Boolean, isPickVideo: Boolean): ArrayList() + parents.mapNotNullTo(notNull, { it }) + filterDirectories(notNull) + return notNull } fun Context.getWhereCondition(isPickImage: Boolean, isPickVideo: Boolean): String { @@ -86,7 +88,7 @@ fun Context.getArgs(isPickImage: Boolean, isPickVideo: Boolean): Array { } } -fun Context.filterDirectories(dirs: MutableList) { +fun Context.filterDirectories(dirs: ArrayList) { if (!config.showHiddenFolders) { removeHiddenFolders(dirs) removeNoMediaFolders(dirs)