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(); auto json = QJsonDocument::fromJson(data).object();
try { try {
QList<QString> response; QList<QString> response;
for (auto it = json["groups"].toArray().constBegin(); auto array = json["groups"].toArray();
it != json["groups"].toArray().constEnd(); for (auto it = array.constBegin();
it != array.constEnd();
it++) { it++) {
response.append(it->toString()); response.append(it->toString());
} }