From e2d14763b766b2154940a47acb3dffb65d0973d3 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 10 Apr 2015 16:39:14 +0200 Subject: Add validity check for eti_fc --- src/EtiReader.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/EtiReader.cpp') diff --git a/src/EtiReader.cpp b/src/EtiReader.cpp index 7e0df72..0e4182d 100644 --- a/src/EtiReader.cpp +++ b/src/EtiReader.cpp @@ -61,6 +61,7 @@ EtiReader::EtiReader(struct modulator_offset_config& modconf, PDEBUG("EtiReader::EtiReader()\n"); myCurrentFrame = 0; + eti_fc_valid = false; } EtiReader::~EtiReader() @@ -81,12 +82,18 @@ FicSource* EtiReader::getFic() unsigned EtiReader::getMode() { + if (not eti_fc_valid) { + throw std::runtime_error("Trying to access Mode before it is ready!"); + } return eti_fc.MID; } unsigned EtiReader::getFp() { + if (not eti_fc_valid) { + throw std::runtime_error("Trying to access FP before it is ready!"); + } return eti_fc.FP; } @@ -144,6 +151,7 @@ int EtiReader::process(const Buffer* dataIn) return dataIn->getLength() - input_size; } memcpy(&eti_fc, in, 4); + eti_fc_valid = true; input_size -= 4; framesize -= 4; in += 4; -- cgit v1.2.3