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…
Reference in New Issue