mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-26 05:20:10 +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("}]")) {
|
if (startsWith("[{") && endsWith("}]")) {
|
||||||
try {
|
try {
|
||||||
val checklistItemType = object : TypeToken<List<ChecklistItem>>() {}.type
|
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) {
|
} catch (e: Exception) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user