diff --git a/lib/src/Store.dart b/lib/src/Store.dart index 32fd1440..e7cfc218 100644 --- a/lib/src/Store.dart +++ b/lib/src/Store.dart @@ -224,9 +224,9 @@ class Store { txn.rawDelete( "DELETE FROM Events WHERE id=?", [eventContent["event_id"]]); } else if ((status == 1 || status == -1) && - eventUpdate.content["txid"] is String) + eventContent["txid"] is String) txn.rawUpdate("UPDATE Events SET status=?, id=?, WHERE id=?", - [status, eventContent["event_id"], eventUpdate.content["txid"]]); + [status, eventContent["event_id"], eventContent["txid"]]); else txn.rawInsert( "INSERT OR REPLACE INTO Events VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)", [ diff --git a/lib/src/Timeline.dart b/lib/src/Timeline.dart index e01802fd..9933bad7 100644 --- a/lib/src/Timeline.dart +++ b/lib/src/Timeline.dart @@ -47,9 +47,10 @@ class Timeline { int i; for (i = 0; i < events.length; i++) { if (events[i].content.containsKey("txid") && - events[i].content["txid"] == txid || + (txid != null && events[i].content["txid"] == txid) || events[i].id == event_id || - (events[i].content["txid"] == unsigned_txid)) break; + (unsigned_txid != null && events[i].content["txid"] == unsigned_txid)) + break; } return i; }