Check for packets in the queue before we start traversing it to prevent crash

This commit is contained in:
Isaac Connor 2021-04-28 12:12:24 -04:00
parent f754b82f3b
commit a9ca6f8c13
1 changed files with 2 additions and 2 deletions

View File

@ -188,9 +188,9 @@ void PacketQueue::clearPackets(ZMPacket *add_packet) {
}
std::unique_lock<std::mutex> lck(mutex);
// If ananlysis_it isn't at the end, we need to keep that many additional packets
// If analysis_it isn't at the end, we need to keep that many additional packets
int tail_count = 0;
if (pktQueue.back() != add_packet) {
if (pktQueue.size() and (pktQueue.back() != add_packet)) {
packetqueue_iterator it = pktQueue.end();
--it;
while (*it != add_packet) {