From 69040d9dbe2f939c3b8d3c2c9187c43eb01033c9 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 26 Feb 2018 10:49:28 +0100 Subject: [PATCH] add a null check at getting OTG files --- build.gradle | 2 +- .../simplemobiletools/commons/extensions/Context-storage.kt | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index b0ee5ea76..6344671c3 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { propMinSdkVersion = 16 propTargetSdkVersion = propCompileSdkVersion propVersionCode = 1 - propVersionName = '3.13.8' + propVersionName = '3.13.9' kotlin_version = '1.2.21' support_libs = '27.0.2' } diff --git a/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context-storage.kt b/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context-storage.kt index 0478d3604..e758bbea4 100644 --- a/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context-storage.kt +++ b/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context-storage.kt @@ -318,7 +318,10 @@ fun Context.getOTGItems(path: String, countHiddenItems: Boolean, getProperFileSi continue } - rootUri = rootUri.findFile(part) + val file = rootUri.findFile(part) + if (file != null) { + rootUri = file + } } val files = rootUri.listFiles()