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

fix(core): Fix misuse of toxcore tox_file_send API

This commit is contained in:
Mick Sayson 2018-09-23 15:33:43 -07:00
parent 5d65ab3876
commit f988177a9b

View File

@ -123,10 +123,11 @@ void CoreFile::sendFile(Core* core, uint32_t friendId, QString filename, QString
QMutexLocker mlocker(&fileSendMutex);
QByteArray fileName = filename.toUtf8();
TOX_ERR_FILE_SEND sendErr;
uint32_t fileNum = tox_file_send(core->tox.get(), friendId, TOX_FILE_KIND_DATA, filesize,
nullptr, (uint8_t*)fileName.data(), fileName.size(), nullptr);
if (fileNum == std::numeric_limits<uint32_t>::max()) {
qWarning() << "sendFile: Can't create the Tox file sender";
nullptr, (uint8_t*)fileName.data(), fileName.size(), &sendErr);
if (sendErr != TOX_ERR_FILE_SEND_OK) {
qWarning() << "sendFile: Can't create the Tox file sender (" << sendErr << ")";
emit core->fileSendFailed(friendId, filename);
return;
}