From b7b7f6edbb3f87702afd34a1388fc1b00de35c53 Mon Sep 17 00:00:00 2001 From: Ruakij Date: Mon, 22 Nov 2021 21:27:07 +0100 Subject: [PATCH] Fixed exception when signal-data could is missing --- handler/textPacketHandler.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/handler/textPacketHandler.hpp b/handler/textPacketHandler.hpp index 095e193..0d7f718 100644 --- a/handler/textPacketHandler.hpp +++ b/handler/textPacketHandler.hpp @@ -58,8 +58,14 @@ void parseHeader(Packet &packet, const std::vector &textPacket){ packet.frequency = std::stoi(headerData[frequencyIndex]); int signalIndex = findIs(headerData, "signal", 1, 1); + if(signalIndex != -1){ std::string signalText = headerData[signalIndex].substr(0, 3); packet.signal = std::stoi(signalText); + } + else { + fprintf(stderr, "Missing signal-data!\n"); + packet.signal = -100; + } // Addresses seem complicated at first, but just have many fields which might be available. // SA and DA are src- and dst-Addresses