Don't create Digital Radar Data Moment Blocks for empty moment data

Fixes #150
This commit is contained in:
Dan Paulat 2024-02-26 00:06:44 -06:00
parent 524de364f2
commit cca71410f5

View file

@ -532,7 +532,8 @@ bool DigitalRadarData::Parse(std::istream& is)
messageValid = false; messageValid = false;
} }
if (messageValid && p->surveillancePointer_ != 0) if (messageValid && p->surveillancePointer_ != 0 &&
p->numberOfSurveillanceBins_ != 0)
{ {
p->reflectivityDataBlock_ = std::make_shared<Impl::MomentDataBlock>( p->reflectivityDataBlock_ = std::make_shared<Impl::MomentDataBlock>(
this, DataBlockType::MomentRef); this, DataBlockType::MomentRef);
@ -546,7 +547,7 @@ bool DigitalRadarData::Parse(std::istream& is)
p->numberOfSurveillanceBins_); p->numberOfSurveillanceBins_);
} }
if (messageValid && p->velocityPointer_ != 0) if (messageValid && p->velocityPointer_ != 0 && p->numberOfDopplerBins_ != 0)
{ {
p->dopplerVelocityDataBlock_ = std::make_shared<Impl::MomentDataBlock>( p->dopplerVelocityDataBlock_ = std::make_shared<Impl::MomentDataBlock>(
this, DataBlockType::MomentVel); this, DataBlockType::MomentVel);
@ -561,7 +562,8 @@ bool DigitalRadarData::Parse(std::istream& is)
p->numberOfDopplerBins_); p->numberOfDopplerBins_);
} }
if (messageValid && p->spectralWidthPointer_ != 0) if (messageValid && p->spectralWidthPointer_ != 0 &&
p->numberOfDopplerBins_ != 0)
{ {
p->dopplerSpectrumWidthDataBlock_ = p->dopplerSpectrumWidthDataBlock_ =
std::make_shared<Impl::MomentDataBlock>(this, std::make_shared<Impl::MomentDataBlock>(this,