Merge pull request #9056 from Atlante45/networking

Protect against empty packet lists
This commit is contained in:
Ryan Huffman 2016-11-11 15:28:46 -08:00 committed by GitHub
commit 2203607044

View file

@ -165,6 +165,12 @@ qint64 Socket::writePacketList(std::unique_ptr<PacketList> packetList, const Hif
// hand this packetList off to writeReliablePacketList
// because Qt can't invoke with the unique_ptr we have to release it here and re-construct in writeReliablePacketList
if (packetList->getNumPackets() == 0) {
qCWarning(networking) << "Trying to send packet list with 0 packets, bailing.";
return 0;
}
if (QThread::currentThread() != thread()) {
auto ptr = packetList.release();
QMetaObject::invokeMethod(this, "writeReliablePacketList", Qt::AutoConnection,