Skip to content

Commit 7e7234d

Browse files
committed
changing some code to avoid ConcurrentModificationExceptions
1 parent 981c198 commit 7e7234d

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

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

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -191,20 +191,19 @@ class ChecklistFragment : NoteFragment(), ChecklistItemsListener {
191191
return
192192
}
193193

194-
ensureBackgroundThread {
195-
context?.let { ctx ->
196-
note?.let { currentNote ->
197-
if (refreshIndex != -1) {
198-
view.checklist_list.post {
199-
view.checklist_list.adapter?.notifyItemChanged(refreshIndex)
200-
}
201-
}
202-
203-
currentNote.value = getChecklistItems()
204-
saveNoteValue(note!!, currentNote.value)
205-
ctx.updateWidgets()
194+
if (note != null) {
195+
if (refreshIndex != -1) {
196+
view.checklist_list.post {
197+
view.checklist_list.adapter?.notifyItemChanged(refreshIndex)
206198
}
207199
}
200+
201+
note!!.value = getChecklistItems()
202+
203+
ensureBackgroundThread {
204+
saveNoteValue(note!!, note!!.value)
205+
context?.updateWidgets()
206+
}
208207
}
209208
}
210209

0 commit comments

Comments
 (0)