adding an extra check to avoid deleting wrong notes

This commit is contained in:
tibbi 2019-12-07 13:56:53 +01:00
parent 4c98d5201e
commit e13926e6f5
2 changed files with 4 additions and 4 deletions

View File

@ -628,12 +628,12 @@ class MainActivity : SimpleActivity() {
private fun displayDeleteNotePrompt() {
DeleteNoteDialog(this, mCurrentNote) {
deleteNote(it)
deleteNote(it, mCurrentNote)
}
}
fun deleteNote(deleteFile: Boolean) {
if (mNotes.size <= 1) {
fun deleteNote(deleteFile: Boolean, note: Note) {
if (mNotes.size <= 1 || note != mCurrentNote) {
return
}

View File

@ -118,7 +118,7 @@ class TextFragment : NoteFragment() {
val fileContents = note!!.getNoteStoredValue()
if (fileContents == null) {
(activity as MainActivity).deleteNote(false)
(activity as MainActivity).deleteNote(false, note!!)
return
}