From 293d8a73904cb2eda487bc2932671af8c10b9b27 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 21 Dec 2018 10:39:54 +0100 Subject: [PATCH] scan OTG paths only if there is an OTG device connected --- .../simplemobiletools/gallery/pro/helpers/MediaFetcher.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt index b57e37c70..df6ef77c7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt @@ -26,9 +26,11 @@ class MediaFetcher(val context: Context) { } val curMedia = ArrayList() - if (curPath.startsWith(OTG_PATH)) { - val newMedia = getMediaOnOTG(curPath, isPickImage, isPickVideo, filterMedia, favoritePaths, getVideoDurations) - curMedia.addAll(newMedia) + if (curPath.startsWith(OTG_PATH, true)) { + if (context.hasOTGConnected()) { + val newMedia = getMediaOnOTG(curPath, isPickImage, isPickVideo, filterMedia, favoritePaths, getVideoDurations) + curMedia.addAll(newMedia) + } } else { val newMedia = getMediaInFolder(curPath, isPickImage, isPickVideo, filterMedia, getProperDateTaken, favoritePaths, getVideoDurations) curMedia.addAll(newMedia)