mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-30 08:18:00 +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 firstItem = curMedia.first()
|
||||||
val lastItem = curMedia.last()
|
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 ?: ""
|
var thumbnail = curMedia.firstOrNull { context.getDoesFilePathExist(it.path) }?.path ?: ""
|
||||||
if (thumbnail.startsWith(OTG_PATH)) {
|
if (thumbnail.startsWith(OTG_PATH)) {
|
||||||
thumbnail = thumbnail.getOTGPublicPath(context)
|
thumbnail = thumbnail.getOTGPublicPath(context)
|
||||||
|
|
|
@ -113,7 +113,7 @@ class MediaFetcher(val context: Context) {
|
||||||
if (cursor.moveToFirst()) {
|
if (cursor.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
val path = cursor.getStringValue(MediaStore.Images.Media.DATA).trim()
|
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)) {
|
if (!includedFolders.contains(parentPath)) {
|
||||||
foldersToScan.add(parentPath)
|
foldersToScan.add(parentPath)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue