File tree Expand file tree Collapse file tree
app/src/main/java/com/simplemobiletools/notes/activities Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
101101 }
102102
103103 private void updateSelectedNote (int index ) {
104+ saveText ();
104105 mConfig .setCurrentNoteIndex (index );
105106 mCurrentNote = mNotes .get (index );
106107 mNotesView .setText (mCurrentNote .getValue ());
@@ -134,6 +135,7 @@ public void onClick(View v) {
134135 } else if (mDb .doesTitleExist (title )) {
135136 Utils .showToast (getApplicationContext (), R .string .title_taken );
136137 } else {
138+ saveText ();
137139 final Note newNote = new Note (0 , title , "" );
138140 final int id = mDb .insertNote (newNote );
139141 newNote .setId (id );
@@ -205,6 +207,9 @@ public void onClick(DialogInterface dialog, int which) {
205207 }
206208
207209 private void saveText () {
210+ if (mCurrentNote == null )
211+ return ;
212+
208213 final String newText = getCurrentNote ();
209214 final String oldText = mCurrentNote .getValue ();
210215 if (!newText .equals (oldText )) {
You can’t perform that action at this time.
0 commit comments