mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-31 03:14:56 +00:00
Avoid segmentation fault if the Tracking item_type is not defined for the given implementation
This commit is contained in:
parent
7f23b6d88b
commit
862bdeea5c
@ -23,7 +23,8 @@
|
||||
#include "telemetry_decoder_interface.h"
|
||||
#include "tracking_interface.h"
|
||||
#include <glog/logging.h>
|
||||
#include <utility> // for std::move
|
||||
#include <stdexcept> // for std::invalid_argument
|
||||
#include <utility> // for std::move
|
||||
|
||||
|
||||
Channel::Channel(const ConfigurationInterface* configuration,
|
||||
@ -113,6 +114,13 @@ void Channel::connect(gr::top_block_sptr top_block)
|
||||
acq_->connect(top_block);
|
||||
}
|
||||
trk_->connect(top_block);
|
||||
|
||||
if (trk_->item_size() == 0)
|
||||
{
|
||||
std::string msg = trk_->role() + ".item_type is not defined for implementation " + trk_->implementation() + '\n';
|
||||
throw std::invalid_argument(msg);
|
||||
}
|
||||
|
||||
nav_->connect(top_block);
|
||||
|
||||
// Synchronous ports
|
||||
|
@ -72,7 +72,7 @@ BeidouB1iDllPllTracking::BeidouB1iDllPllTracking(
|
||||
}
|
||||
else
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
item_size_ = 0;
|
||||
LOG(WARNING) << trk_params.item_type << " unknown tracking item type.";
|
||||
}
|
||||
channel_ = 0;
|
||||
|
@ -64,7 +64,7 @@ BeidouB3iDllPllTracking::BeidouB3iDllPllTracking(
|
||||
}
|
||||
else
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
item_size_ = 0;
|
||||
LOG(WARNING) << trk_params.item_type << " unknown tracking item type.";
|
||||
}
|
||||
channel_ = 0;
|
||||
|
@ -65,7 +65,7 @@ GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking(
|
||||
}
|
||||
else
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
item_size_ = 0;
|
||||
LOG(WARNING) << trk_params.item_type << " unknown tracking item type.";
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ GalileoE1TcpConnectorTracking::GalileoE1TcpConnectorTracking(
|
||||
}
|
||||
else
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
item_size_ = 0;
|
||||
LOG(WARNING) << item_type << " unknown tracking item type.";
|
||||
}
|
||||
channel_ = 0;
|
||||
|
@ -65,7 +65,7 @@ GalileoE5aDllPllTracking::GalileoE5aDllPllTracking(
|
||||
}
|
||||
else
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
item_size_ = 0;
|
||||
LOG(WARNING) << trk_params.item_type << " unknown tracking item type.";
|
||||
}
|
||||
channel_ = 0;
|
||||
|
@ -66,7 +66,7 @@ GalileoE5bDllPllTracking::GalileoE5bDllPllTracking(
|
||||
}
|
||||
else
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
item_size_ = 0;
|
||||
LOG(WARNING) << trk_params.item_type << " unknown tracking item type.";
|
||||
}
|
||||
channel_ = 0;
|
||||
|
@ -61,7 +61,7 @@ GalileoE6DllPllTracking::GalileoE6DllPllTracking(
|
||||
}
|
||||
else
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
item_size_ = 0;
|
||||
LOG(WARNING) << trk_params.item_type << " unknown tracking item type.";
|
||||
}
|
||||
channel_ = 0;
|
||||
|
@ -95,7 +95,7 @@ GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking(
|
||||
}
|
||||
else
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
item_size_ = 0;
|
||||
LOG(WARNING) << item_type_ << " unknown tracking item type.";
|
||||
}
|
||||
channel_ = 0;
|
||||
|
@ -70,7 +70,7 @@ GlonassL1CaDllPllTracking::GlonassL1CaDllPllTracking(
|
||||
}
|
||||
else
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
item_size_ = 0;
|
||||
LOG(WARNING) << item_type << " unknown tracking item type.";
|
||||
}
|
||||
channel_ = 0;
|
||||
|
@ -93,7 +93,7 @@ GlonassL2CaDllPllCAidTracking::GlonassL2CaDllPllCAidTracking(
|
||||
}
|
||||
else
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
item_size_ = 0;
|
||||
LOG(WARNING) << item_type_ << " unknown tracking item type.";
|
||||
}
|
||||
channel_ = 0;
|
||||
|
@ -68,7 +68,7 @@ GlonassL2CaDllPllTracking::GlonassL2CaDllPllTracking(
|
||||
}
|
||||
else
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
item_size_ = 0;
|
||||
LOG(WARNING) << item_type << " unknown tracking item type.";
|
||||
}
|
||||
channel_ = 0;
|
||||
|
@ -73,7 +73,7 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking(
|
||||
}
|
||||
else
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
item_size_ = 0;
|
||||
LOG(WARNING) << trk_params.item_type << " unknown tracking item type.";
|
||||
}
|
||||
channel_ = 0;
|
||||
|
@ -72,7 +72,7 @@ GpsL1CaDllPllTrackingGPU::GpsL1CaDllPllTrackingGPU(
|
||||
}
|
||||
else
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
item_size_ = 0;
|
||||
LOG(WARNING) << item_type << " unknown tracking item type.";
|
||||
}
|
||||
channel_ = 0;
|
||||
|
@ -81,7 +81,7 @@ GpsL1CaKfTracking::GpsL1CaKfTracking(
|
||||
}
|
||||
else
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
item_size_ = 0;
|
||||
LOG(WARNING) << item_type << " unknown tracking item type.";
|
||||
}
|
||||
channel_ = 0;
|
||||
|
@ -60,7 +60,7 @@ GpsL1CaTcpConnectorTracking::GpsL1CaTcpConnectorTracking(
|
||||
}
|
||||
else
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
item_size_ = 0;
|
||||
LOG(WARNING) << item_type << " unknown tracking item type.";
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ GpsL2MDllPllTracking::GpsL2MDllPllTracking(
|
||||
}
|
||||
else
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
item_size_ = 0;
|
||||
LOG(WARNING) << trk_params.item_type << " unknown tracking item type.";
|
||||
}
|
||||
channel_ = 0;
|
||||
|
@ -65,7 +65,7 @@ GpsL5DllPllTracking::GpsL5DllPllTracking(
|
||||
}
|
||||
else
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
item_size_ = 0;
|
||||
LOG(WARNING) << trk_params.item_type << " unknown tracking item type.";
|
||||
}
|
||||
channel_ = 0;
|
||||
|
@ -393,6 +393,11 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetChannel(
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
if (trk_->item_size() == 0)
|
||||
{
|
||||
LOG(ERROR) << trk_->role() << ".item_type=" << acq_item_type << " is not defined for implementation " << trk_->implementation();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<GNSSBlockInterface> channel_ = std::make_unique<Channel>(configuration, channel,
|
||||
std::move(acq_),
|
||||
|
@ -804,7 +804,7 @@ int GNSSFlowgraph::connect_channels()
|
||||
else
|
||||
{
|
||||
LOG(ERROR) << "Can't connect channel " << i << " internally";
|
||||
help_hint_ += " * Check implementation names for Channel" + std::to_string(i) + " inner blocks.\n";
|
||||
help_hint_ += " * Check your configuration for Channel" + std::to_string(i) + " inner blocks.\n";
|
||||
help_hint_ += " Acquisition blocks documentation at https://gnss-sdr.org/docs/sp-blocks/acquisition/\n";
|
||||
help_hint_ += " Tracking blocks documentation at https://gnss-sdr.org/docs/sp-blocks/tracking/\n";
|
||||
help_hint_ += " Telemetry Decoder blocks documentation at https://gnss-sdr.org/docs/sp-blocks/telemetry-decoder/\n";
|
||||
|
Loading…
Reference in New Issue
Block a user