1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix(core): Check that result of get peer name is successful

Fix #4802
This commit is contained in:
Diadlo 2017-11-17 23:37:46 +03:00
parent 2f9ba3c4d7
commit 78262b41bd
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727

View File

@ -1126,6 +1126,10 @@ QStringList Core::getGroupPeerNames(int groupId) const
QStringList names; QStringList names;
for (uint32_t i = 0; i < nPeers; ++i) { for (uint32_t i = 0; i < nPeers; ++i) {
size_t length = tox_conference_peer_get_name_size(tox, groupId, i, &error); size_t length = tox_conference_peer_get_name_size(tox, groupId, i, &error);
if (!parsePeerQueryError(error)) {
continue;
}
QByteArray name(length, Qt::Uninitialized); QByteArray name(length, Qt::Uninitialized);
uint8_t* namePtr = static_cast<uint8_t*>(static_cast<void*>(name.data())); uint8_t* namePtr = static_cast<uint8_t*>(static_cast<void*>(name.data()));
bool ok = tox_conference_peer_get_name(tox, groupId, i, namePtr, &error); bool ok = tox_conference_peer_get_name(tox, groupId, i, namePtr, &error);