Browse Source

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
reviewable/pr5923/r4
Mick Sayson 6 years ago committed by Anthony Bilinski
parent
commit
836718aa26
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
  1. 5
      src/core/core.cpp

5
src/core/core.cpp

@ -1242,6 +1242,7 @@ QStringList Core::getGroupPeerNames(int groupId) const @@ -1242,6 +1242,7 @@ QStringList Core::getGroupPeerNames(int groupId) const
TOX_ERR_CONFERENCE_PEER_QUERY error;
size_t length = tox_conference_peer_get_name_size(tox.get(), groupId, i, &error);
if (!parsePeerQueryError(error)) {
names.append(QString());
continue;
}
@ -1250,9 +1251,13 @@ QStringList Core::getGroupPeerNames(int groupId) const @@ -1250,9 +1251,13 @@ QStringList Core::getGroupPeerNames(int groupId) const
bool ok = tox_conference_peer_get_name(tox.get(), groupId, i, namePtr, &error);
if (ok && parsePeerQueryError(error)) {
names.append(ToxString(name).getQString());
} else {
names.append(QString());
}
}
assert(names.size() == nPeers);
return names;
}

Loading…
Cancel
Save