Skip to content

Commit f6ae948

Browse files
committed
Prevent widget crash when checklist is empty
1 parent 1d14be9 commit f6ae948

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/src/main/kotlin/com/simplemobiletools/notes/pro/adapters/WidgetAdapter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class WidgetAdapter(val context: Context, val intent: Intent) : RemoteViewsServi
126126
val noteId = intent.getLongExtra(NOTE_ID, 0L)
127127
note = context.notesDB.getNoteWithId(noteId)
128128
if (note?.type == NoteType.TYPE_CHECKLIST) {
129-
checklistItems = note!!.getNoteStoredValue(context)?.let { Json.decodeFromString(it) } ?: mutableListOf()
129+
checklistItems = note!!.getNoteStoredValue(context)?.ifEmpty { "[]" }?.let { Json.decodeFromString(it) } ?: mutableListOf()
130130

131131
// checklist title can be null only because of the glitch in upgrade to 6.6.0, remove this check in the future
132132
checklistItems = checklistItems.filter { it.title != null }.toMutableList() as ArrayList<ChecklistItem>

0 commit comments

Comments
 (0)