]> gitweb.stoutner.com Git - PrivacyCell.git/blobdiff - app/src/main/java/com/stoutner/privacycell/activities/LogcatActivity.kt
Partial German translation.
[PrivacyCell.git] / app / src / main / java / com / stoutner / privacycell / activities / LogcatActivity.kt
index 122ccc544364f1fe2b69108bb35c5d34f31fb57e..ca396c233c010dadecc5d8721b9eee28b3982a03 100644 (file)
@@ -58,7 +58,7 @@ class LogcatActivity : AppCompatActivity() {
     private lateinit var logcatScrollView: ScrollView
     private lateinit var logcatTextView: TextView
 
-    // Define the save logcat activity result launcher.
+    // Define the save logcat activity result launcher.  It must be defined before `onCreate()` is run or the app will crash.
     private val saveLogcatActivityResultLauncher = registerForActivityResult(ActivityResultContracts.CreateDocument()) { fileNameUri: Uri? ->
         // Only save the file if the URI is not null, which happens if the user exited the file picker by pressing back.
         if (fileNameUri != null) {
@@ -82,7 +82,7 @@ class LogcatActivity : AppCompatActivity() {
                 contentResolverCursor.moveToFirst()
 
                 // Get the file name from the cursor.
-                val fileNameString = contentResolverCursor.getString(contentResolverCursor.getColumnIndex(OpenableColumns.DISPLAY_NAME))
+                val fileNameString = contentResolverCursor.getString(contentResolverCursor.getColumnIndexOrThrow(OpenableColumns.DISPLAY_NAME))
 
                 // Close the cursor.
                 contentResolverCursor.close()