Fix the segfault

when iterating over the JSON array in getOwnCommunities
This commit is contained in:
Max Sandholm 2017-11-02 16:18:27 +02:00 committed by GitHub
parent dc6aeccad3
commit 2f6df70a8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -490,8 +490,9 @@ MatrixClient::getOwnCommunities() noexcept
auto json = QJsonDocument::fromJson(data).object();
try {
QList<QString> response;
for (auto it = json["groups"].toArray().constBegin();
it != json["groups"].toArray().constEnd();
auto array = json["groups"].toArray();
for (auto it = array.constBegin();
it != array.constEnd();
it++) {
response.append(it->toString());
}