mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
fix(groups): Fix invalid group list on group member join
The call to Core::getGroupPeerNames is expected to return a list where the index in the list is the group member id. In any error case we were previously breaking this constraint. It turns out that every time someone joins a group we call this function before they have a valid name resulting in their id not being added to the list. This fix ensures that the list coming out of Core::getGroupPeerNames always has a full list. Fixes #5838
This commit is contained in:
parent
08436bc2f1
commit
836718aa26
|
@ -1242,6 +1242,7 @@ QStringList Core::getGroupPeerNames(int groupId) const
|
||||||
TOX_ERR_CONFERENCE_PEER_QUERY error;
|
TOX_ERR_CONFERENCE_PEER_QUERY error;
|
||||||
size_t length = tox_conference_peer_get_name_size(tox.get(), groupId, i, &error);
|
size_t length = tox_conference_peer_get_name_size(tox.get(), groupId, i, &error);
|
||||||
if (!parsePeerQueryError(error)) {
|
if (!parsePeerQueryError(error)) {
|
||||||
|
names.append(QString());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1250,9 +1251,13 @@ QStringList Core::getGroupPeerNames(int groupId) const
|
||||||
bool ok = tox_conference_peer_get_name(tox.get(), groupId, i, namePtr, &error);
|
bool ok = tox_conference_peer_get_name(tox.get(), groupId, i, namePtr, &error);
|
||||||
if (ok && parsePeerQueryError(error)) {
|
if (ok && parsePeerQueryError(error)) {
|
||||||
names.append(ToxString(name).getQString());
|
names.append(ToxString(name).getQString());
|
||||||
|
} else {
|
||||||
|
names.append(QString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(names.size() == nPeers);
|
||||||
|
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user