[Room] LastEvent calulcation fix

This commit is contained in:
Christian Pauly 2019-08-29 09:52:37 +02:00
parent 93b4efe004
commit 6d143241eb

View file

@ -126,9 +126,12 @@ class Room {
Event get lastEvent { Event get lastEvent {
ChatTime lastTime = ChatTime(0); ChatTime lastTime = ChatTime(0);
Event lastEvent = null; Event lastEvent = Event();
states.forEach((String key, RoomState value) { states.forEach((String key, RoomState state) {
if (value.time > lastTime) lastEvent = value.timelineEvent; if (state.time > lastTime) {
lastTime = state.time;
lastEvent = state.timelineEvent;
}
}); });
return lastEvent; return lastEvent;
} }