[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 {
ChatTime lastTime = ChatTime(0);
Event lastEvent = null;
states.forEach((String key, RoomState value) {
if (value.time > lastTime) lastEvent = value.timelineEvent;
Event lastEvent = Event();
states.forEach((String key, RoomState state) {
if (state.time > lastTime) {
lastTime = state.time;
lastEvent = state.timelineEvent;
}
});
return lastEvent;
}