We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 545fc85 commit 1cad543Copy full SHA for 1cad543
app/src/main/kotlin/org/fossify/notes/activities/MainActivity.kt
@@ -869,17 +869,16 @@ class MainActivity : SimpleActivity() {
869
}
870
871
private fun checkUri(uri: Uri, onChecksPassed: () -> Unit) {
872
- val inputStream = try {
873
- contentResolver.openInputStream(uri) ?: return
+ try {
+ contentResolver.openInputStream(uri)?.use { inputStream ->
874
+ if (inputStream.available() > 1000 * 1000) {
875
+ toast(R.string.file_too_large)
876
+ } else {
877
+ onChecksPassed()
878
+ }
879
+ } ?: return
880
} catch (e: Exception) {
881
showErrorToast(e)
- return
- }
-
- if (inputStream.available() > 1000 * 1000) {
- toast(R.string.file_too_large)
- } else {
882
- onChecksPassed()
883
884
885
0 commit comments