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
575ee61855
commit
fd243738c1
|
@ -1502,7 +1502,9 @@ QStringList Core::getGroupPeerNames(int groupId) const
|
|||
for (uint32_t i = 0; i < nPeers; ++i) {
|
||||
Tox_Err_Conference_Peer_Query error;
|
||||
size_t length = tox_conference_peer_get_name_size(tox.get(), groupId, i, &error);
|
||||
|
||||
if (!PARSE_ERR(error) || !length) {
|
||||
names.append(QString());
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1510,9 +1512,13 @@ QStringList Core::getGroupPeerNames(int groupId) const
|
|||
tox_conference_peer_get_name(tox.get(), groupId, i, nameBuf.data(), &error);
|
||||
if (PARSE_ERR(error)) {
|
||||
names.append(ToxString(nameBuf.data(), length).getQString());
|
||||
} else {
|
||||
names.append(QString());
|
||||
}
|
||||
}
|
||||
|
||||
assert(names.size() == nPeers);
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user