return end iterator instead of crashing

This commit is contained in:
Robin Müller 2022-05-24 14:33:18 +02:00
parent 5a425a1c58
commit e59f1f26bf
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -9,7 +9,7 @@
CCSDSDistributor::CCSDSDistributor(uint16_t setDefaultApid, object_id_t setObjectId) CCSDSDistributor::CCSDSDistributor(uint16_t setDefaultApid, object_id_t setObjectId)
: TcDistributor(setObjectId), defaultApid(setDefaultApid) {} : TcDistributor(setObjectId), defaultApid(setDefaultApid) {}
CCSDSDistributor::~CCSDSDistributor() {} CCSDSDistributor::~CCSDSDistributor() = default;
TcDistributor::TcMqMapIter CCSDSDistributor::selectDestination() { TcDistributor::TcMqMapIter CCSDSDistributor::selectDestination() {
#if CCSDS_DISTRIBUTOR_DEBUGGING == 1 #if CCSDS_DISTRIBUTOR_DEBUGGING == 1
@ -38,6 +38,7 @@ TcDistributor::TcMqMapIter CCSDSDistributor::selectDestination() {
" store failed!\n"); " store failed!\n");
#endif #endif
#endif #endif
return queueMap.end();
} }
SpacePacketBase currentPacket(packet); SpacePacketBase currentPacket(packet);
@ -45,7 +46,7 @@ TcDistributor::TcMqMapIter CCSDSDistributor::selectDestination() {
sif::info << "CCSDSDistributor::selectDestination has packet with APID " << std::hex sif::info << "CCSDSDistributor::selectDestination has packet with APID " << std::hex
<< currentPacket.getAPID() << std::dec << std::endl; << currentPacket.getAPID() << std::dec << std::endl;
#endif #endif
TcMqMapIter position = this->queueMap.find(currentPacket.getAPID()); auto position = this->queueMap.find(currentPacket.getAPID());
if (position != this->queueMap.end()) { if (position != this->queueMap.end()) {
return position; return position;
} else { } else {