Fixed exception when signal-data could is missing

OLD_dev
Ruakij 3 years ago
parent 8d67321d4b
commit b7b7f6edbb

@ -58,8 +58,14 @@ void parseHeader(Packet &packet, const std::vector<std::string> &textPacket){
packet.frequency = std::stoi(headerData[frequencyIndex]); packet.frequency = std::stoi(headerData[frequencyIndex]);
int signalIndex = findIs(headerData, "signal", 1, 1); int signalIndex = findIs(headerData, "signal", 1, 1);
if(signalIndex != -1){
std::string signalText = headerData[signalIndex].substr(0, 3); std::string signalText = headerData[signalIndex].substr(0, 3);
packet.signal = std::stoi(signalText); 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. // Addresses seem complicated at first, but just have many fields which might be available.
// SA and DA are src- and dst-Addresses // SA and DA are src- and dst-Addresses

Loading…
Cancel
Save