refactor: Check correct if null

This checks it in a more consistent way
and also makes developing new
databases easier as they
might set the json key but
set it null.
This commit is contained in:
Krille 2023-05-11 12:17:53 +02:00
parent 801ed31362
commit c714574c3f
No known key found for this signature in database
1 changed files with 1 additions and 1 deletions

View File

@ -211,7 +211,7 @@ class Event extends MatrixEvent {
type: jsonPayload['type'], type: jsonPayload['type'],
eventId: jsonPayload['event_id'] ?? '', eventId: jsonPayload['event_id'] ?? '',
senderId: jsonPayload['sender'], senderId: jsonPayload['sender'],
originServerTs: jsonPayload.containsKey('origin_server_ts') originServerTs: jsonPayload['origin_server_ts'] != null
? DateTime.fromMillisecondsSinceEpoch( ? DateTime.fromMillisecondsSinceEpoch(
jsonPayload['origin_server_ts']) jsonPayload['origin_server_ts'])
: DateTime.now(), : DateTime.now(),