mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 14:37:59 +01:00
handle null file parent in some cases
This commit is contained in:
parent
22df8edfda
commit
e67517dd4c
2 changed files with 2 additions and 2 deletions
|
@ -38,7 +38,7 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va
|
|||
|
||||
val firstItem = curMedia.first()
|
||||
val lastItem = curMedia.last()
|
||||
val parentDir = if (hasOTG && firstItem.path.startsWith(OTG_PATH)) firstItem.path.getParentPath() else File(firstItem.path).parent
|
||||
val parentDir = if (hasOTG && firstItem.path.startsWith(OTG_PATH)) firstItem.path.getParentPath() else File(firstItem.path).parent ?: continue
|
||||
var thumbnail = curMedia.firstOrNull { context.getDoesFilePathExist(it.path) }?.path ?: ""
|
||||
if (thumbnail.startsWith(OTG_PATH)) {
|
||||
thumbnail = thumbnail.getOTGPublicPath(context)
|
||||
|
|
|
@ -113,7 +113,7 @@ class MediaFetcher(val context: Context) {
|
|||
if (cursor.moveToFirst()) {
|
||||
do {
|
||||
val path = cursor.getStringValue(MediaStore.Images.Media.DATA).trim()
|
||||
val parentPath = File(path).parent.trimEnd('/')
|
||||
val parentPath = File(path).parent?.trimEnd('/') ?: continue
|
||||
if (!includedFolders.contains(parentPath)) {
|
||||
foldersToScan.add(parentPath)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue