summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2019-09-07 14:37:54 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2019-11-23 20:06:14 +0100
commitaae295cb02920d00dd6f31b82f9f267aa10f42de (patch)
tree13b885b3847de63b19769157fd6edd78db3031c8
parentMake reply and options buttons smaller (diff)
downloadnheko-aae295cb02920d00dd6f31b82f9f267aa10f42de.tar.xz
Fix new messages not arriving in qml timeline
-rw-r--r--src/timeline2/TimelineModel.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/timeline2/TimelineModel.cpp b/src/timeline2/TimelineModel.cpp
index dff5e56e..28820205 100644
--- a/src/timeline2/TimelineModel.cpp
+++ b/src/timeline2/TimelineModel.cpp
@@ -241,6 +241,9 @@ TimelineModel::addEvents(const mtx::responses::Timeline &timeline)
                 isInitialSync     = false;
         }
 
+        if (timeline.events.empty())
+                return;
+
         std::vector<QString> ids;
         for (const auto &e : timeline.events) {
                 QString id =
@@ -251,8 +254,8 @@ TimelineModel::addEvents(const mtx::responses::Timeline &timeline)
         }
 
         beginInsertRows(QModelIndex(),
-                        static_cast<int>(this->events.size()),
-                        static_cast<int>(this->events.size() + ids.size() - 1));
+                        static_cast<int>(this->eventOrder.size()),
+                        static_cast<int>(this->eventOrder.size() + ids.size() - 1));
         this->eventOrder.insert(this->eventOrder.end(), ids.begin(), ids.end());
         endInsertRows();
 }