Fix a crash when deselecting a packet

This commit is contained in:
Stanislav Mykhailenko 2024-09-06 21:52:09 +03:00
parent 8ea5985e70
commit 118a1eb787
GPG key ID: 1E95E66A9C9D6A36

View file

@ -81,6 +81,8 @@ void PacketAnalyzer::refresh()
void PacketAnalyzer::packetSelected() void PacketAnalyzer::packetSelected()
{ {
if (ui->t_packets->selectedItems().length() == 0)
return;
int packetId = ui->t_packets->selectedItems()[0]->text().toInt(); int packetId = ui->t_packets->selectedItems()[0]->text().toInt();
pcpp::RawPacket* packet = m_packets.at(packetId-1); pcpp::RawPacket* packet = m_packets.at(packetId-1);
ui->e_selected->setText(PacketManager::getPacketData(packet)); ui->e_selected->setText(PacketManager::getPacketData(packet));