fixing a couple crashes
This commit is contained in:
parent
f76a0cf0ce
commit
311f412c87
|
@ -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'
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue