Fix Event decode bug
This commit is contained in:
parent
8aa27feac3
commit
9666b763a5
|
@ -130,12 +130,11 @@ class Event {
|
|||
static Event fromJson(Map<String, dynamic> jsonObj, Room room) {
|
||||
Map<String, dynamic> content = jsonObj["content"];
|
||||
|
||||
if (content == null)
|
||||
if (content == null && jsonObj["content_json"] != null)
|
||||
try {
|
||||
content = json.decode(jsonObj["content_json"]);
|
||||
} catch (e) {
|
||||
print(
|
||||
"jsonObj decode of event content '$jsonObj' failed: ${e.toString()}");
|
||||
print("jsonObj decode of event content failed: ${e.toString()}");
|
||||
content = {};
|
||||
}
|
||||
|
||||
|
|
|
@ -474,10 +474,8 @@ class Store {
|
|||
|
||||
List<Event> eventList = [];
|
||||
|
||||
for (num i = 0; i < eventRes.length; i++) {
|
||||
print("Try to parse Event $i of ${eventRes.length}: ${eventRes[i]}");
|
||||
for (num i = 0; i < eventRes.length; i++)
|
||||
eventList.add(Event.fromJson(eventRes[i], room));
|
||||
}
|
||||
|
||||
return eventList;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue