From a38846aeed9467ccb3283930840fa48a1e285c14 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Fri, 11 Nov 2016 11:51:08 -0800 Subject: [PATCH] Protect against empty packet lists --- libraries/networking/src/udt/Socket.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libraries/networking/src/udt/Socket.cpp b/libraries/networking/src/udt/Socket.cpp index 98cc62bdee..d2583dce72 100644 --- a/libraries/networking/src/udt/Socket.cpp +++ b/libraries/networking/src/udt/Socket.cpp @@ -165,6 +165,12 @@ qint64 Socket::writePacketList(std::unique_ptr 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,