Skip to content

Commit

Permalink
[fix] fixes potential crash in opening of text file.
Browse files Browse the repository at this point in the history
  • Loading branch information
coderPaddyS committed Nov 12, 2024
1 parent c0320f9 commit 9e2e8d1
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ class TextNoteActivity : BaseNoteActivity(DbContract.NoteEntry.TYPE_TEXT) {
val uri: Uri? = listOf(intent.data, intent.getParcelableExtra(Intent.EXTRA_STREAM)).firstNotNullOfOrNull { it }
if (uri != null) {
val (title: String, text) = InputStreamReader(contentResolver.openInputStream(uri)).readLines().let {
if (PreferenceManager.getDefaultSharedPreferences(this@TextNoteActivity).getBoolean("settings_import_text_title_file_first_line", false)) {
if (it.size > 1 &&
PreferenceManager.getDefaultSharedPreferences(this@TextNoteActivity).getBoolean("settings_import_text_title_file_first_line", false)) {
it[0] to it.subList(1, it.size)
} else {
(uri.path?.let { file -> File(file).nameWithoutExtension } ?: "") to it
Expand Down

0 comments on commit 9e2e8d1

Please sign in to comment.