adding some crashfixes

This commit is contained in:
tibbi 2021-10-16 09:47:45 +02:00
parent 8ab1ae60ea
commit c7ae139ad6
2 changed files with 11 additions and 1 deletions

View file

@ -231,7 +231,12 @@ class ReadTextActivity : SimpleActivity() {
filePath = uri.path!!
val file = File(filePath)
if (file.exists()) {
file.readText()
try {
file.readText()
} catch (e: Exception) {
showErrorToast(e)
""
}
} else {
toast(R.string.unknown_error_occurred)
""

View file

@ -11,6 +11,7 @@ import android.util.AttributeSet
import androidx.appcompat.app.AppCompatActivity
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.helpers.isOreoPlus
import com.simplemobiletools.filemanager.pro.R
import com.simplemobiletools.filemanager.pro.activities.MimeTypesActivity
import com.simplemobiletools.filemanager.pro.activities.SimpleActivity
@ -86,6 +87,10 @@ class StorageFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
}
private fun getSizes() {
if (!isOreoPlus()) {
return
}
ensureBackgroundThread {
getMainStorageStats(context)