mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-23 12:00:15 +01:00
be stricter at parsing jsons
This commit is contained in:
parent
9bf17625a5
commit
a64eabde8e
@ -8,7 +8,7 @@ fun String.parseChecklistItems(): ArrayList<ChecklistItem>? {
|
||||
if (startsWith("[{") && endsWith("}]")) {
|
||||
try {
|
||||
val checklistItemType = object : TypeToken<List<ChecklistItem>>() {}.type
|
||||
return Gson().fromJson<ArrayList<ChecklistItem>>(this, checklistItemType) ?: ArrayList(1)
|
||||
return Gson().fromJson<ArrayList<ChecklistItem>>(this, checklistItemType) ?: null
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user