diff --git a/app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/ChecklistFragment.kt b/app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/ChecklistFragment.kt index 76edfeeb..7eee0ec2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/ChecklistFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/ChecklistFragment.kt @@ -191,20 +191,19 @@ class ChecklistFragment : NoteFragment(), ChecklistItemsListener { return } - ensureBackgroundThread { - context?.let { ctx -> - note?.let { currentNote -> - if (refreshIndex != -1) { - view.checklist_list.post { - view.checklist_list.adapter?.notifyItemChanged(refreshIndex) - } - } - - currentNote.value = getChecklistItems() - saveNoteValue(note!!, currentNote.value) - ctx.updateWidgets() + if (note != null) { + if (refreshIndex != -1) { + view.checklist_list.post { + view.checklist_list.adapter?.notifyItemChanged(refreshIndex) } } + + note!!.value = getChecklistItems() + + ensureBackgroundThread { + saveNoteValue(note!!, note!!.value) + context?.updateWidgets() + } } }