mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 11:35:20 +02:00
Merge pull request #9056 from Atlante45/networking
Protect against empty packet lists
This commit is contained in:
commit
2203607044
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
|
// 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
|
// 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()) {
|
if (QThread::currentThread() != thread()) {
|
||||||
auto ptr = packetList.release();
|
auto ptr = packetList.release();
|
||||||
QMetaObject::invokeMethod(this, "writeReliablePacketList", Qt::AutoConnection,
|
QMetaObject::invokeMethod(this, "writeReliablePacketList", Qt::AutoConnection,
|
||||||
|
|
Loading…
Reference in a new issue