Skip to content

Commit 8969a1a

Browse files
committed
fix a glitch with disappearing note values
1 parent fbc58ab commit 8969a1a

File tree

1 file changed

+4
-2
lines changed
  • app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments

1 file changed

+4
-2
lines changed

app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/NoteFragment.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,14 @@ class NoteFragment : androidx.fragment.app.Fragment() {
101101

102102
override fun onSaveInstanceState(outState: Bundle) {
103103
super.onSaveInstanceState(outState)
104-
outState.putString(TEXT, getCurrentNoteViewText())
104+
if (note != null) {
105+
outState.putString(TEXT, getCurrentNoteViewText())
106+
}
105107
}
106108

107109
override fun onViewStateRestored(savedInstanceState: Bundle?) {
108110
super.onViewStateRestored(savedInstanceState)
109-
if (savedInstanceState != null) {
111+
if (savedInstanceState != null && note != null && savedInstanceState.containsKey(TEXT)) {
110112
skipTextUpdating = true
111113
val newText = savedInstanceState.getString(TEXT) ?: ""
112114
view.notes_view.setText(newText)

0 commit comments

Comments
 (0)