mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
Protect against empty packet lists
This commit is contained in:
parent
5454dca82e
commit
a38846aeed
1 changed files with 6 additions and 0 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue