mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-19 18:10:07 +01:00
Prevent widget crash when checklist is empty
This commit is contained in:
parent
1d14be99a9
commit
f6ae948fb0
@ -126,7 +126,7 @@ class WidgetAdapter(val context: Context, val intent: Intent) : RemoteViewsServi
|
|||||||
val noteId = intent.getLongExtra(NOTE_ID, 0L)
|
val noteId = intent.getLongExtra(NOTE_ID, 0L)
|
||||||
note = context.notesDB.getNoteWithId(noteId)
|
note = context.notesDB.getNoteWithId(noteId)
|
||||||
if (note?.type == NoteType.TYPE_CHECKLIST) {
|
if (note?.type == NoteType.TYPE_CHECKLIST) {
|
||||||
checklistItems = note!!.getNoteStoredValue(context)?.let { Json.decodeFromString(it) } ?: mutableListOf()
|
checklistItems = note!!.getNoteStoredValue(context)?.ifEmpty { "[]" }?.let { Json.decodeFromString(it) } ?: mutableListOf()
|
||||||
|
|
||||||
// checklist title can be null only because of the glitch in upgrade to 6.6.0, remove this check in the future
|
// checklist title can be null only because of the glitch in upgrade to 6.6.0, remove this check in the future
|
||||||
checklistItems = checklistItems.filter { it.title != null }.toMutableList() as ArrayList<ChecklistItem>
|
checklistItems = checklistItems.filter { it.title != null }.toMutableList() as ArrayList<ChecklistItem>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user