summary refs log tree commit diff
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-01-21 18:25:58 +0200
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-01-21 18:25:58 +0200
commitfc890f572c602b098aceb1fad21ad8bfe84c8131 (patch)
treebd9e91e3381accd3de92d1f1e6065fcdf1bb09d2
parentUse the Accept-Content header to enable response compression (diff)
downloadnheko-fc890f572c602b098aceb1fad21ad8bfe84c8131.tar.xz
Fix iterator crash
-rw-r--r--src/MatrixClient.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/MatrixClient.cc b/src/MatrixClient.cc
index 44257172..fdc675b4 100644
--- a/src/MatrixClient.cc
+++ b/src/MatrixClient.cc
@@ -516,11 +516,10 @@ MatrixClient::getOwnCommunities() noexcept
 
                 try {
                         QList<QString> response;
-                        for (auto it = json["groups"].toArray().constBegin();
-                             it != json["groups"].toArray().constEnd();
-                             it++) {
-                                response.append(it->toString());
-                        }
+
+                        for (auto group : json["groups"].toArray())
+                                response.append(group.toString());
+
                         emit getOwnCommunitiesResponse(response);
                 } catch (DeserializationException &e) {
                         qWarning() << "Own communities:" << e.what();