diff --git a/app/build.gradle b/app/build.gradle index 5eacf3711..559d56d2d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -32,7 +32,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.1.2' + compile 'com.simplemobiletools:commons:2.1.5' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.3.1' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index 266cbed2e..f545f14fe 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -195,7 +195,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { for (delPath in mToBeDeleted) { val dir = File(delPath) if (dir.exists()) { - val files = dir.listFiles() + val files = dir.listFiles() ?: continue files.forEach { if (it.isFile && it.isImageVideoGif()) { updatedFiles.add(it) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 48ec61ff6..fb1e21004 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -244,7 +244,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun deleteDirectoryIfEmpty() { val file = File(mDirectory) - if (file.isDirectory && file.listFiles().isEmpty()) { + if (file.isDirectory && file.listFiles()?.isEmpty() == true) { file.delete() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt index 5d10d9430..dddbcabab 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt @@ -74,7 +74,7 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va media.sort() for ((name, path, isVideo, dateModified, dateTaken, size) in media) { - val parentDir = File(path).parent + val parentDir = File(path).parent ?: continue if (directories.containsKey(parentDir)) { val directory: Directory = directories[parentDir]!! val newImageCnt = directory.mediaCnt + 1