@@ -111,7 +111,10 @@ class NoteFragment : Fragment() {
111111 }
112112
113113 if (menuVisible && noteId != 0 ) {
114- (activity as MainActivity ).currentNoteTextChanged(getCurrentNoteViewText())
114+ val currentText = getCurrentNoteViewText()
115+ if (currentText != null ) {
116+ (activity as MainActivity ).currentNoteTextChanged(currentText)
117+ }
115118 }
116119 }
117120
@@ -128,7 +131,7 @@ class NoteFragment : Fragment() {
128131
129132 val newText = getCurrentNoteViewText()
130133 val oldText = context!! .getNoteStoredValue(note)
131- if (newText != oldText) {
134+ if (newText != null && newText != oldText) {
132135 note.value = newText
133136 saveNoteValue(note)
134137 context!! .updateWidget()
@@ -144,11 +147,14 @@ class NoteFragment : Fragment() {
144147 db.updateNoteValue(note)
145148 (activity as MainActivity ).noteSavedSuccessfully(note.title)
146149 } else {
147- (activity as MainActivity ).exportNoteValueToFile(note.path, getCurrentNoteViewText(), true )
150+ val currentText = getCurrentNoteViewText()
151+ if (currentText != null ) {
152+ (activity as MainActivity ).exportNoteValueToFile(note.path, currentText, true )
153+ }
148154 }
149155 }
150156
151- fun getCurrentNoteViewText () = view.notes_view?.text.toString()
157+ fun getCurrentNoteViewText () = view.notes_view?.text? .toString()
152158
153159 private fun getTextGravity () = when (context!! .config.gravity) {
154160 GRAVITY_CENTER -> Gravity .CENTER_HORIZONTAL
0 commit comments